private async void UxClosePopupButton(object sender, RoutedEventArgs e) { uxIngredientPopup.IsOpen = false; await UpdateIngredientRequest.SendUpdateIngredientRequest(selectedIngredient._id, "quantity", selectedIngredient.quantity.ToString()); await RefreshIngredientList(); }
public void UpdateIngredient(UpdateIngredientRequest model) { DataProvider.ExecuteNonQuery(GetConnection, "dbo.Ingredients_UpdateById" , inputParamMapper : delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@id", model.Id); paramCollection.AddWithValue("@name", model.Name); paramCollection.AddWithValue("@quantity", model.Quantity); paramCollection.AddWithValue("@measurementtype", model.MeasurementType); } ); }
public HttpResponseMessage UpdateIngredient(UpdateIngredientRequest model, int ingredientid) { if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } model.Id = ingredientid; //Update Recipe _IngredientsService.UpdateIngredient(model); return(Request.CreateResponse(HttpStatusCode.OK)); }
public async Task DecrementIngredients() { //get all of the ingredients for the current order await GetIngredientsRequest.SendGetIngredientsListRequest(); foreach (MenuItems m in c_ordersMaster.menuItems) { foreach (string i in m.ingredients) { string check = i; int newQuantity = RealmManager.Find <Ingredients>(i).quantity - 1; var validResponse = await UpdateIngredientRequest.SendUpdateIngredientRequest(i, "quantity", newQuantity.ToString()); } } }
public ActionResult <IngredientDto> UpdateIngredient([Required] Guid id, [FromBody] UpdateIngredientRequest request) { Ingredient ingredient = context.Ingredients.SingleOrDefault(x => x.Id == id); if (ingredient == null) { return(this.NotFound()); } ingredient.Name = request.Name; ingredient.Quantity = request.Quantity; context.Ingredients.Update(ingredient); context.SaveChanges(); return(ingredient.ToDto()); }
public async Task <ActionResult <IngredientResponse> > UpdateIngredientAsync(UpdateIngredientRequest request, [FromServices] Command <UpdateIngredientRequest, IngredientResponse> command) => await command.ExecuteAsync(request);
public async Task Put([FromUri] int id, [FromBody] UpdateIngredientRequest updateIngredientRequest) { await m_ingredientService.UpdateIngredient(id, updateIngredientRequest); }