public async Task <TDto> CreateAsync <TDto>(FoodManage dto) where TDto : class, IFoodViewable { var food = mapper.Map <Food>(dto); await CreateAsync(food); return(mapper.Map <TDto>(food)); }
public async Task <IActionResult> UpdateAsync([FromBody] FoodManage dto) { try { await foodService.CreateAsync(dto); return(Ok()); } catch (EntityNotFoundException <Food> ) { return(NoContent()); } catch (Exception) { return(BadRequest()); } }
public async Task CreateAsync(FoodManage dto) { var food = mapper.Map <Food>(dto); await CreateAsync(food); }