public async Task <IActionResult> Create([Bind("Id,Name")] Categories categories) { if (ModelState.IsValid) { _context.Add(categories); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(categories)); }
public async Task <IActionResult> Create([Bind("Id,Name,CategoryId")] Markets markets) { if (ModelState.IsValid) { _context.Add(markets); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CategoryId"] = new SelectList(_context.Categories, "Id", "Name", markets.CategoryId); return(View(markets)); }
public async Task <IActionResult> Create([Bind("Id,Name,Info,DepartmentId")] Workers workers) { if (ModelState.IsValid) { _context.Add(workers); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["DepartmentId"] = new SelectList(_context.Departments, "Id", "Id", workers.DepartmentId); return(View(workers)); }
public async Task <IActionResult> Create([Bind("Id,MarketId")] Departments departments) { if (ModelState.IsValid) { _context.Add(departments); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["MarketId"] = new SelectList(_context.Markets, "Id", "Name", departments.MarketId); return(View(departments)); }
public async Task <IActionResult> Create([Bind("Id,OwnerId,MarketId")] OwnerMarket ownerMarket) { if (ModelState.IsValid) { _context.Add(ownerMarket); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["MarketId"] = new SelectList(_context.Markets, "Id", "Name", ownerMarket.MarketId); ViewData["OwnerId"] = new SelectList(_context.Owners, "Id", "Name", ownerMarket.OwnerId); return(View(ownerMarket)); }