示例#1
0
 public IActionResult Create([FromBody] MinorStop minorstop)
 {
     if (minorstop == null)
     {
         return(BadRequest());
     }
     repo.Add(minorstop);
     return(CreatedAtRoute("GetMinorStop", new { id = minorstop.MinorStopId }, minorstop));
 }
示例#2
0
        // 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();
            }
        }
示例#3
0
        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());
        }
示例#4
0
 // Add an MinorStop
 public void Add(MinorStop minorstop)
 {
     _context.MinorStop.Add(minorstop);
     _context.SaveChanges();
 }