public IActionResult Create([FromBody] UnPlanned unplanned)
 {
     if (unplanned == null)
     {
         return(BadRequest());
     }
     repo.Add(unplanned);
     return(CreatedAtRoute("GetUnPlanned", new { id = unplanned.UnPlannedId }, unplanned));
 }
Example #2
0
        // Update an UnPlanned
        public void Update(UnPlanned unplanned)
        {
            var unplannedToUpdate = _context.UnPlanned.Single(o => o.UnPlannedId == unplanned.UnPlannedId);

            if (unplannedToUpdate != null)
            {
                unplannedToUpdate.Oeeid = unplanned.Oeeid;
                _context.SaveChanges();
            }
        }
        public IActionResult Update(int id, [FromBody] UnPlanned unplanned)
        {
            if (unplanned == null || unplanned.UnPlannedId != id)
            {
                return(BadRequest());
            }

            var unplannedItem = repo.Find(id);

            if (unplannedItem == null)
            {
                return(NotFound());
            }

            repo.Update(unplanned);
            return(new NoContentResult());
        }
Example #4
0
 // Add an UnPlanned
 public void Add(UnPlanned unplanned)
 {
     _context.UnPlanned.Add(unplanned);
     _context.SaveChanges();
 }