public async Task <IActionResult> Create([Bind("idMerchant,lstname,fstname,storename,phone,website,stt")] Model.Users.Merchant merchant) { if (ModelState.IsValid) { _context.Add(merchant); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(merchant)); }
public async Task <IActionResult> Create([Bind("idAccount,username,passwd,avt_path,rate,rankVip,IdMerchant,idCustomer")] Account account) { if (ModelState.IsValid) { _context.Add(account); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } //ViewData["idCustomer"] = new SelectList(_context.Customers, "idCustomer", "idCustomer", account.idCustomer); //ViewData["IdMerchant"] = new SelectList(_context.Merchants, "idMerchant", "idMerchant", account.IdMerchant); return(View(account)); }
public async Task <IActionResult> Create([Bind("idProduct,nameProduct,Code,Description,Image,Size,Sex,OldPrice,Price,Creat_date,Count,Fee,Home,Status,View,Color,idCategory,idAccount,IdRepository,IdBrand")] Product product) { if (ModelState.IsValid) { _context.Add(product); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["idAccount"] = new SelectList(_context.Accounts, "idAccount", "idAccount", product.idAccount); ViewData["IdBrand"] = new SelectList(_context.Brands, "IdBrand", "IdBrand", product.IdBrand); ViewData["idCategory"] = new SelectList(_context.Categories, "idCategory", "idCategory", product.idCategory); ViewData["IdRepository"] = new SelectList(_context.Repositories, "idRepository", "idRepository", product.IdRepository); return(View(product)); }
public async Task <IActionResult> Edit(string id, [Bind("id,id_Acc,id_Mer,createdDate,Checked,stt")] RegisterNotify registerNotify) { if (id != registerNotify.id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(registerNotify); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RegisterNotifyExists(registerNotify.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(registerNotify)); }