public bool EditShift(Context.Entities.Shift shift) { try { var shiftEntity = Entities.Shifts.Where(x => x.ShiftId == shift.ShiftId && x.IsDeleted == false && x.IsCancelled == false).FirstOrDefault(); if (shiftEntity == null) { return(false); } shiftEntity.EmployeeId = shift.EmployeeId; shiftEntity.StartTime = shift.StartTime; shiftEntity.EndTime = shift.EndTime; Entities.SaveChanges(); return(true); } catch (Exception ex) { throw ex; } }
public bool AddShift(Context.Entities.Shift shift) { try { Entities.Shifts.Add(shift); Entities.SaveChanges(); return(true); } catch (Exception ex) { throw ex; } }