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()); }
public async Task PostNewShiftAsync(Shift shift) { _shiftContext.Add(shift.ToDTO()); await _shiftContext.SaveChangesAsync(); }