private async Task InsertPizzas(IServiceScope scope) { var mysqlPizzaRepo = scope.ServiceProvider.GetRequiredService <Domain.Interfaces.Repositories.IPizzaRepository>(); var pizzas = await mysqlPizzaRepo.Get(x => x.Active); await _pizzaRepo.Delete(); pizzas.ToList().ForEach(async(e) => await _pizzaRepo.Create(new PizzaCollection(e.Id, e.Name, e.Price, e.Active))); }
public async Task <Guid> AddPizza([FromBody] PizzaModel pizza) { await _pizzaValidator.ValidateAndThrowAsync(pizza); var mPizza = Mapper.Map <PizzaModel, Pizza>(pizza); return(await _repository.Create(mPizza)); }
public IActionResult Create(Pizza model) { //submit the pizza from form var newPizza = pizzaRepository.Create(model); return(RedirectToAction("Details", new { id = newPizza.Id })); }
public IEnumerable <Pizza> Post([FromBody] Pizza pizza) { _repository.Create(pizza); return(_repository.GetAll()); }