public async Task <IActionResult> UpdateMeal(int mealId, [FromBody] MealDTO mealDTO) { var command = new UpdateMealCommand(mealId, mealDTO.Meal, mealDTO.Price, mealDTO.Url); var result = await _mediatr.Send(command); return(result.Failure ? Conflict(result) : (IActionResult)Created(string.Empty, result.Success)); }
public async Task <IActionResult> Put(int id, [FromBody] UpdateMealCommand command) { if (!this.ModelState.IsValid) { return(this.BadRequest(this.ModelState)); } var response = await this._mediator.Send(command); return(this.Ok()); }
public async Task <IActionResult> UpdateAsync(Guid id, [FromBody] UpdateMealCommand command) { command.MealId = id; return(await CreateCommandResponse(command)); }