public async Task <IActionResult> Edit(int id, [Bind("Id,City,Country,Date,PizzaId")] Orgins orgins)
        {
            if (id != orgins.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(orgins);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrginsExists(orgins.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            ViewData["PizzaId"] = new SelectList(_context.Pizzas.OrderBy(p => p.Name), "Id", "Name", orgins.PizzaId);
            return(View(orgins));
        }
        public async Task <IActionResult> Create([Bind("Id,City,Country,Date,PizzaId")] Orgins orgins)
        {
            if (ModelState.IsValid)
            {
                if (!OrginsPizzaIdExists(orgins))
                {
                    _context.Add(orgins);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction("Index"));
                }
            }
            ViewData["PizzaId"] = new SelectList(_context.Pizzas.Where(x => x.Orgins.PizzaId != x.Id).OrderBy(p => p.Name), "Id", "Name", orgins.PizzaId);
            return(View(orgins));
        }
 private bool OrginsPizzaIdExists(Orgins origins)
 {
     return(_context.Orgins.Any(o => o.PizzaId == origins.PizzaId));
 }