//Creates a drink object with the listed paramteters below. public async Task <DrinkForListDto> Create(DrinkForListDto drink) { var dr = new Drink() { ProductNameBold = drink.ProductNameBold, Category = drink.Category, Volume = drink.Volume, Price = drink.Price, Taste = drink.Taste, Image = drink.Image }; _context.Drinks.Add(dr); await _context.SaveChangesAsync(); return(DrinkTranslator.TodrinkForListDto(dr)); }
public async Task <IActionResult> Create([FromBody] DrinkForListDto drink) { var result = await _drinkService.Create(drink); return(new OkObjectResult(ApiResponse.Create(result))); }