public async Task <IActionResult> Create([Bind("Id,name")] Country country) { if (ModelState.IsValid) { _context.Add(country); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(country)); }
public async Task <IActionResult> Create( [Bind("Id,email,createdAt,updatedAt")] Client client ) { if (ModelState.IsValid) { _context.Add(client); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(client)); }
public async Task <IActionResult> Create( [Bind(@"Id,sku,name,description,price,msrp,inventory,image,hot,createdAt, updatedAt")] Product product ) { if (ModelState.IsValid) { _context.Add(product); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(product)); }
public async Task <IActionResult> Create( [Bind(@"Id,paymentMethod,total,ApiOrderId,status,clientForeignKey, productForeignKey")] Order order ) { if (ModelState.IsValid) { _context.Add(order); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["clientForeignKey"] = new SelectList( _context.Client, "Id", "email", order.clientForeignKey ); ViewData["productForeignKey"] = new SelectList( _context.Product, "Id", "description", order.productForeignKey ); return(View(order)); }
public async Task <IActionResult> Create( [Bind(@"Id,type,firstName,lastName,email,line1,line2,city,zipCode,phone, createdAt,updatedAt,countryForeignKey,clientForeignKey")] Address address ) { if (ModelState.IsValid) { _context.Add(address); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["clientForeignKey"] = new SelectList( _context.Client, "Id", "email", address.clientForeignKey ); ViewData["countryForeignKey"] = new SelectList( _context.Country, "Id", "name", address.countryForeignKey ); return(View(address)); }