public async Task <IActionResult> Create([Bind("Id,Username,Password,Gender,Email,RealName,RegisterTime,Province,City,Town,Addr,IsDel")] BbsBuyer bbsBuyer) { if (ModelState.IsValid) { _context.Add(bbsBuyer); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(bbsBuyer)); }
public async Task <IActionResult> Create([Bind("Id,Code,Name")] BbsProvince bbsProvince) { if (ModelState.IsValid) { _context.Add(bbsProvince); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(bbsProvince)); }
public async Task <IActionResult> Create([Bind("Id,Name,Description,ImgUrl,WebSite,Sort,IsDisplay")] BbsBrand bbsBrand) { if (ModelState.IsValid) { _context.Add(bbsBrand); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(bbsBrand)); }
public async Task <IActionResult> Create([Bind("Username,Password,Degree,Email,Gender,ImgUrl,Phone,RealName,School,IsDel")] BbsEmployee bbsEmployee) { if (ModelState.IsValid) { _context.Add(bbsEmployee); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(bbsEmployee)); }
public async Task <IActionResult> Create([Bind("Id,BuyerId,Name,City,Addr,Phone,IsDef")] BbsAddr bbsAddr) { if (ModelState.IsValid) { _context.Add(bbsAddr); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["BuyerId"] = new SelectList(_context.BbsBuyer, "Username", "Username", bbsAddr.BuyerId); return(View(bbsAddr)); }
public async Task <IActionResult> Create([Bind("Id,No,Name,Weight,IsNew,IsHot,IsCommend,CreateTime,CreateUserId,CheckTime,CheckUserId,IsShow,IsDel,TypeId,BrandId,Keywords,Sales,Description,PackageList,Feature,Color,Size")] BbsProduct bbsProduct) { if (ModelState.IsValid) { _context.Add(bbsProduct); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["BrandId"] = new SelectList(_context.BbsBrand, "Id", "Id", bbsProduct.BrandId); ViewData["TypeId"] = new SelectList(_context.BbsType, "Id", "Id", bbsProduct.TypeId); return(View(bbsProduct)); }
public async Task SeedAsync(ecomContext context) { if (!context.BbsBuyer.Any()) { context.BbsBuyer.AddRange(GetPreconfiguredBbsBuyers()); await context.SaveChangesAsync(); } if (!context.BbsBrand.Any()) { context.BbsBrand.AddRange(GetPreconfiguredBbsBrands()); await context.SaveChangesAsync(); } }