public async Task <IActionResult> Create([Bind("MaterialId,MaterialName,Description,Price")] Material material) { if (ModelState.IsValid) { _context.Add(material); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(material)); }
public async Task <IActionResult> Create([Bind("CustomerId,Surname,Name,MiddleName,Adress,Phone,Passport")] Customer customer) { if (ModelState.IsValid) { _context.Add(customer); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(customer)); }
public async Task <IActionResult> Create([Bind("TypeOfWorkId,WorkName,Description,Price")] TypeOfWork typeOfWork) { if (ModelState.IsValid) { _context.Add(typeOfWork); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(typeOfWork)); }
public async Task <IActionResult> Create([Bind("WorkerId,Surname,Name,MiddleName,Age,Sex,Adress,Phone,Passport,PositionId,TeamId")] Worker worker) { if (ModelState.IsValid) { _context.Add(worker); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["TeamId"] = new SelectList(_context.Teams, "TeamId", "TeamName", worker.TeamId); ViewData["PositionId"] = new SelectList(_context.Positions, "PositionId", "PositionName", worker.PositionId); return(View(worker)); }
public async Task <IActionResult> Create([Bind("OrderId,TeamId,CustomerId,TypeOfWorkId,Price,StartDate,FinishDate,ComplectionStatus,PayStatus")] Order order) { if (ModelState.IsValid) { _context.Add(order); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CustomerId"] = new SelectList(_context.Customers, "CustomerId", "CustomerId", order.CustomerId); ViewData["TeamId"] = new SelectList(_context.Teams, "TeamId", "TeamId", order.Team.TeamId); ViewData["TypeOfWorkId"] = new SelectList(_context.TypeOfWorks, "TypeOfWorkId", "TypeOfWorkId", order.TypeOfWorkId); return(View(order)); }
public async Task <IActionResult> Create([Bind("TeamId,TeamName")] Team team) { try { if (ModelState.IsValid) { _context.Add(team); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } } catch { } return(View(team)); }