Esempio n. 1
0
        public IActionResult UpdateFuel([FromBody] Fuel uFuel)
        {
            var oFuel = context.Fuels.Find(uFuel.Id);

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

            oFuel.Name     = uFuel.Name;
            oFuel.Capacity = uFuel.Capacity;
            context.SaveChanges();

            return(Ok(oFuel));
        }
Esempio n. 2
0
 public IActionResult CreatePlan([FromBody] Plan newPlan)
 {
     context.Plans.Add(newPlan);
     context.SaveChanges();
     return(Created("", newPlan));
 }