public async Task Add(FoodItemApiModel model) { await this.foodItemRepository.Add(new Models.Data.FoodItem() { Name = model.Name, Cost = model.Cost.Value }); }
public async Task <IActionResult> Post([FromBody] FoodItemApiModel model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } await manager.Add(model); return(Ok()); }