public async Task <ActionResult <IEnumerable <Slot> > > GetDays() { var today = DateTime.Today.ToString("yyyy/MM/dd"); var currDayPresent = await _context.Days .AnyAsync(i => i.DateKey == today); if (!currDayPresent) { _context.Days.Add(new Day { DateKey = today }); try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { throw; } } var list = await _context.Days.ToListAsync(); return(Ok(list)); }
public async Task <IActionResult> PutKombi(string id, Kombi kombi) { if (id != kombi.KombiId) { return(BadRequest()); } _context.Entry(kombi).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!KombiExists(id)) { return(NotFound()); } else { throw; } } return(Ok(kombi)); }
public async Task <IActionResult> PutRoute(string id, Route route) { if (id != route.RouteId) { return(BadRequest()); } _context.Entry(route).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RouteExists(id)) { return(NotFound()); } else { throw; } } return(Ok(route)); }