public IActionResult Create([FromBody] MinorStop minorstop) { if (minorstop == null) { return(BadRequest()); } repo.Add(minorstop); return(CreatedAtRoute("GetMinorStop", new { id = minorstop.MinorStopId }, minorstop)); }
// Update an MinorStop public void Update(MinorStop minorstop) { var minorstopToUpdate = _context.MinorStop.Single(o => o.MinorStopId == minorstop.MinorStopId); if (minorstopToUpdate != null) { minorstopToUpdate._25minute = minorstop._25minute; minorstopToUpdate.MinorStopDate = minorstop.MinorStopDate; _context.SaveChanges(); } }
public IActionResult Update(int id, [FromBody] MinorStop minorstop) { if (minorstop == null || minorstop.MinorStopId != id) { return(BadRequest()); } var minorstopItem = repo.Find(id); if (minorstopItem == null) { return(NotFound()); } repo.Update(minorstop); return(new NoContentResult()); }
// Add an MinorStop public void Add(MinorStop minorstop) { _context.MinorStop.Add(minorstop); _context.SaveChanges(); }