public ShiftTypeModel UptdatePartialShiftType(ShiftTypeModel shiftTypeModel) { ShiftType shiftType = DB.ShiftTypes.SingleOrDefault(s => s.ShiftTypeId == shiftTypeModel.ShiftTypeId); if (shiftType == null) { return(null); } if (shiftType.TypeTitle != null) { shiftType.TypeTitle = shiftTypeModel.TypeTitle; } if (shiftType.Starts != null) { shiftType.Starts = shiftTypeModel.Starts; } if (shiftType.Ends != null) { shiftType.Ends = shiftTypeModel.Ends; } DB.SaveChanges(); return(shiftTypeModel); }
public ShiftTypeModel AddShiftTypeModel(ShiftTypeModel shiftTypeModel) { ShiftType shiftType = shiftTypeModel.ConvertToShiftType(); DB.ShiftTypes.Add(shiftType); DB.SaveChanges(); shiftTypeModel.ShiftTypeId = shiftType.ShiftTypeId; return(shiftTypeModel); }
public ShiftTypeModel UptdateFullShiftType(ShiftTypeModel shiftTypeModel) { ShiftType futureShift = DB.ShiftTypes.SingleOrDefault(s => s.ShiftTypeId == shiftTypeModel.ShiftTypeId); if (futureShift == null) { return(null); } futureShift.TypeTitle = shiftTypeModel.TypeTitle; futureShift.Starts = shiftTypeModel.Starts; futureShift.Ends = shiftTypeModel.Ends; DB.SaveChanges(); return(shiftTypeModel); }