I am developing ASP.NET MVC application using entity framework and for data access i am following unitofwork and repository pattern. For UI, I am using kendo.
Now i implemented kendo grid which is bind to signalr, so that different user can see the live updates.
Issue
Any database operation that i perform via signalr hub was not reflecting into the database.
[Microsoft.AspNet.SignalR.Authorize(Roles = "SuperAdmin")]
public class EquipmentTypeHub : Hub
{
public ILogisticsService Service { get; set; }
public EquipmentTypeHub()
{
Service = GetLogisticsService();
}
private LogisticsService GetLogisticsService()
{
LogisticsService logisticsService = DependencyResolver.Current.GetService<LogisticsService>();
return logisticsService;
}
public void SaveEquipmentType(EquipmentTypeViewModel model)
{
try
{
var equipmentType = Service.GetEquipmentTypes<EquipmentType>(a => a.Id == model.Id).FirstOrDefault();
if (equipmentType == null)
{
equipmentType = new EquipmentType();
}
equipmentType.EquipmentTypeName = "Firefox"; //I am trying to update a record from chrome to firefox
equipmentType.EquipmentTypeId = model.EquipmentTypeId;
equipmentType.IsActive = model.IsActive;
Service.SaveEquipmentType<EquipmentType>(equipmentType);
Clients.Others.SaveEquipmentType(model);
}
catch (Exception ex)
{
throw ex;
}
}
}
Below was the record i am trying to update:

But record remains unchanged and system also didn't throw any error.
Below was the actual content of the model before commit()

Update
If i do the same as unauthenticated user the database gets updated and i am using asp.net identity 2.0
Appreciate your help thanks!
SaveEquipmentType, yet DB isn't updated. Problem most likely is in your service then - can you follow the debug into that?modelwhen you debug. It most likely is blank