public async Task <IActionResult> Create([Bind("AdvisorID,Name,Surname,Email,BirthNumber,Age,Phone")] Advisor advisor) { if (ModelState.IsValid) { _context.Add(advisor); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(advisor)); }
public async Task <IActionResult> Create([Bind("InstitutionID,Name")] Institution institution) { if (ModelState.IsValid) { _context.Add(institution); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(institution)); }
public async Task <IActionResult> Create([Bind("ContractID,EvidenceNumber,InstitutionID,ClientID,AdministratorID,ConclusionDate,ValidityDate,EndDate")] Contract contract) { if (ModelState.IsValid) { _context.Add(contract); await _context.SaveChangesAsync(); _context.Add(new ContractAdvisor { ContractID = contract.ContractID, AdvisorID = contract.AdministratorID }); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["AdministratorID"] = new SelectList(_context.Advisor, "AdvisorID", "FullName", contract.AdministratorID); ViewData["ClientID"] = new SelectList(_context.Client, "ClientID", "FullName", contract.ClientID); ViewData["InstitutionID"] = new SelectList(_context.Institution, "InstitutionID", "Name", contract.InstitutionID); return(View(contract)); }