public ActionResult Delete(int CPlantilla) { var plantilla = servicioPlantilla.Listar() .Where(t => t.CodPlantilla == CPlantilla) .FirstOrDefault(); servicioPlantilla.Eliminar(plantilla); return(RedirectToAction("Index")); }
public ActionResult Delete(int id, [FromBody] Plantilla plantilla) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id == plantilla.CodPlantilla) { servicioPlantilla.Eliminar(plantilla); } else { return(NotFound()); } return(new CreatedAtRouteResult("GetPlantilla", id = plantilla.CodPlantilla, plantilla)); }