public async Task <IHttpActionResult> Post([FromBody] IngredientePlato ingredientePlato) { var idIngredientePlato = await _ingredientePlatoBl.GuardarAsync(ingredientePlato); if (idIngredientePlato == 0) { throw new Exception("No se pudo crear el ingredientePlato"); } return(Ok(idIngredientePlato)); }
public bool Modificar(IngredientePlato IngredientePlato, int id) { string url = $"http://localhost/restaurant/api/ingredientePlatos/{id}"; var respuesta = _restClientHttp.Put <bool>(url, IngredientePlato); if (respuesta.StatusName != HttpStatusCode.OK) { return(false); } return(respuesta.Response); }
public int Guardar(IngredientePlato IngredientePlato) { string url = $"http://localhost/restaurant/api/ingredientePlatos/"; var respuesta = _restClientHttp.Post <int>(url, IngredientePlato); if (respuesta.StatusName != HttpStatusCode.OK) { return(0); } return(respuesta.Response); }
public Task <int> InsertAsync(IngredientePlato ingredientePlato) { const string spName = "sp_insertIngredientePlato"; return(_repository.ExecuteProcedureAsync <int>(spName, new Dictionary <string, object> { { "@p_cantidad_insumo", ingredientePlato.CantidadInsumo }, { "@p_insumo_id", ingredientePlato.IdInsumo }, { "@p_plato_id", ingredientePlato.IdPlato }, { "@p_return", 0 } }, CommandType.StoredProcedure)); }
public async Task <IHttpActionResult> Put([FromBody] IngredientePlato ingredientePlato, int id) { if (id == 0) { throw new Exception("El id del ingredientePlato debe ser mayor a cero"); } ingredientePlato.Id = id; var esActualizado = await _ingredientePlatoBl.ModificarAsync(ingredientePlato); if (esActualizado == 0) { throw new Exception("No se pudo actualizar el ingredientePlato"); } return(Ok(esActualizado)); }
public Task <int> ModificarAsync(IngredientePlato ingredientePlato) { return(_unitOfWork.IngredientePlatoDal.UpdateAsync(ingredientePlato)); }
public Task <int> GuardarAsync(IngredientePlato ingredientePlato) { return(_unitOfWork.IngredientePlatoDal.InsertAsync(ingredientePlato)); }