public async Task <IActionResult> Create([Bind("ID,LastName,MiddleName,FirstName,Gender,Address,Mobile")] User user) { if (ModelState.IsValid) { _context.Add(user); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(user)); }
public async Task <IActionResult> Create([Bind("ID,Name,Description,Typr,Brand,Price,Image,Rating")] Mobile mobile) { if (ModelState.IsValid) { _context.Add(mobile); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(mobile)); }
public async Task <IActionResult> Create([Bind("ID,UserID,MobileID,OrderDate")] Order order) { if (ModelState.IsValid) { _context.Add(order); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["MobileID"] = new SelectList(_context.Mobile, "ID", "ID", order.MobileID); ViewData["UserID"] = new SelectList(_context.Set <User>(), "ID", "ID", order.UserID); return(View(order)); }
public async Task SaveAsync() { await _context.SaveChangesAsync(); }