예제 #1
0
        public PastShiftModel UptdatePartialPastShift(PastShiftModel pastShiftModel)
        {
            PastShift pastShift = DB.PastShifts.SingleOrDefault(p => p.ShiftId == pastShiftModel.ShiftId);

            if (pastShift == null)
            {
                return(null);
            }

            if (pastShift.ShiftTypeId != null)
            {
                pastShift.ShiftTypeId = pastShiftModel.ShiftTypeId;
            }

            if (pastShift.EmployeeId != null)
            {
                pastShift.EmployeeId = pastShiftModel.EmployeeId;
            }

            if (pastShift.Started != null)
            {
                pastShift.Started = pastShiftModel.Started;
            }

            if (pastShift.Ended != null)
            {
                pastShift.Ended = pastShiftModel.Ended;
            }

            DB.SaveChanges();
            return(pastShiftModel);
        }
예제 #2
0
        public PastShiftModel AddPastShiftModel(PastShiftModel pastShiftModel)
        {
            PastShift pastShift = pastShiftModel.ConvertToPastShift();

            DB.PastShifts.Add(pastShift);
            DB.SaveChanges();
            pastShiftModel.ShiftId = pastShift.ShiftId;
            return(pastShiftModel);
        }
예제 #3
0
        public PastShiftModel UptdateFullPastShift(PastShiftModel pastShiftModel)
        {
            PastShift pastShift = DB.PastShifts.SingleOrDefault(e => e.ShiftId == pastShiftModel.ShiftId);

            if (pastShift == null)
            {
                return(null);
            }
            pastShift.ShiftTypeId = pastShiftModel.ShiftTypeId;
            pastShift.EmployeeId  = pastShiftModel.EmployeeId;
            pastShift.Started     = pastShiftModel.Started;
            pastShift.Ended       = pastShiftModel.Ended;

            DB.SaveChanges();
            return(pastShiftModel);
        }