예제 #1
0
        public void Add(Shift shift)
        {
            EFShift newShift = new EFShift()
            {
                Start = shift.Start,
                End   = shift.End
            };

            _db.Shifts.Add(newShift);
            _db.SaveChanges();
        }
예제 #2
0
        public void UpdateById(int id, Shift shift)

        {
            EFShift newVersion = Converter.ToEfShift(shift);
            var     result     = _db.Shifts.SingleOrDefault(s => s.ShiftId == id);

            if (result != null)
            {
                result.ShiftId = newVersion.ShiftId;
                result.Start   = newVersion.Start;
                result.End     = newVersion.End;
                _db.SaveChanges();
            }
        }