public async Task <IActionResult> Create(Seller seller, int drpDepartments) { //Validação por parte do servidor if (ModelState.IsValid) { //Popula o objeto com o departamento seller.Departments = await _departmentsDAO.FindToIdAsync(drpDepartments); //Chamada DAO await _selerDAO.InsertAsync(seller); return(RedirectToAction(nameof(Index))); } return(View()); }
public async Task <IActionResult> Details(int?id) { if (id == null) { return(RedirectToAction(nameof(Error), new { message = "Id not provided" })); } var departments = await _departmentsDAO.FindToIdAsync(id.Value); if (departments == null) { return(RedirectToAction(nameof(Error), new { message = "Id not found" })); } return(View(departments)); }