Example #1
0
        public async Task <IActionResult> PutMachine([FromRoute] int id, [FromBody] Machine machine)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != machine.MachineId)
            {
                return(BadRequest());
            }

            _context.Entry(machine).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MachineExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #2
0
 public ActionResult Edit([Bind(Include = "ProduccionId,NombreProducto,Clima")] Produccion produccion)
 {
     if (ModelState.IsValid)
     {
         db.Entry(produccion).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(produccion));
 }