public async Task <IActionResult> Create([Bind("Id,Title")] SubjectModel subjectModel) { if (ModelState.IsValid) { _context.Add(subjectModel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(subjectModel)); }
public async Task <IActionResult> Create(ClientModel clientModel) { if (ModelState.IsValid) { _context.Add(clientModel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(clientModel)); }
public async Task <IActionResult> Create([Bind("Id,SubjectId,Number,Price")] LaboratoryWorkModel laboratoryWorkModel) { if (ModelState.IsValid) { _context.Add(laboratoryWorkModel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["SubjectId"] = new SelectList(_context.Subjects, "Id", "Title", laboratoryWorkModel.SubjectId); return(View(laboratoryWorkModel)); }
public async Task <IActionResult> Create([Bind("Id,ClientId,LaboratoryWorkId,RegisterDateTime,CompleteDateTime,Discount,Payed")] OrderModel orderModel) { if (ModelState.IsValid) { _context.Add(orderModel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ClientId"] = new SelectList(_context.ShortClientsView, "ClientId", "ClientFullName", orderModel.ClientId); ViewData["LaboratoryWorkId"] = new SelectList(_context.LaboratoryWorkDetailedView, "LabWorkId", "ShortName", orderModel.LaboratoryWorkId); return(View(orderModel)); }