示例#1
0
        public async Task <IActionResult> Create(string Title, string Details, DateTime Date, TimeSpan StartTime, TimeSpan EndTime)
        {
            if (StartTime >= EndTime)
            {
                return(BadRequest("bad_times"));
            }

            var shift = new Shift()
            {
                Title     = Title,
                Details   = Details,
                Date      = Date,
                StartTime = StartTime,
                EndTime   = EndTime,
                Series    = 0
            };

            _context.Add(shift);
            await _context.SaveChangesAsync();

            return(Ok());
        }
示例#2
0
 public async Task PostNewShiftAsync(Shift shift)
 {
     _shiftContext.Add(shift.ToDTO());
     await _shiftContext.SaveChangesAsync();
 }