public ActionResult Post([FromBody] Proveedores_Bd gestor) { try { context.Proveedores.Add(gestor); context.SaveChanges(); return(CreatedAtRoute("GetGestor", new { id = gestor.Id_Proveedor }, gestor)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public ActionResult Put(int id, [FromBody] Proveedores_Bd gestor) { try { if (gestor.Id_Proveedor == id) { context.Entry(gestor).State = EntityState.Modified; context.SaveChanges(); return(CreatedAtRoute("GetGestor", new { id = gestor.Id_Proveedor }, gestor)); } else { return(BadRequest()); } } catch (Exception ex) { return(BadRequest(ex.Message)); } }