public async Task <IActionResult> PutBurger(int id, Burger burger) { if (id != burger.Id) { return(BadRequest()); } _context.Entry(burger).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BurgerExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult> Create([Bind(Include = "Id,Email,FIO,Description")] Contacts contacts) { if (ModelState.IsValid) { db.Contacts.Add(contacts); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(contacts)); }
public async Task <ActionResult> Create([Bind(Include = "Id,Name,Description")] News news) { if (ModelState.IsValid) { db.News.Add(news); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(news)); }
public async Task <ActionResult> Create([Bind(Include = "Id,Name,Description,Price,Rating,DishesTypeId")] Dishes dishes) { if (ModelState.IsValid) { db.Dishes.Add(dishes); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.DishesTypeId = new SelectList(db.DishesTypes, "Id", "Name", dishes.DishesTypeId); return(View(dishes)); }