public IActionResult Create(QuotationModel quotation) { bool actionSuccessfully = ModelState.IsValid; if (actionSuccessfully) { // pre: register client clientRepository.setResource("client/"); // metodo utilitario var clientModel = getClientFromQuotation(quotation); var clientCreated = clientRepository.create(clientModel); // asignar el ID del nuevo objeto creado quotation.idContact = clientCreated.id; // call method api quotationRepository.setResource("quotation/"); var quotationCreated = quotationRepository.create(quotation); // Mandar un mensaje de registro satisfactorio TempData["registerSuccessfully"] = true; quotation = new QuotationModel(); ModelState.Clear(); // redirect method //return RedirectToAction(actionName: "Index", controllerName: "Home"); } TempData["quotationViewModel"] = serializeJSON(quotationViewModelRepository.get()); return(View(quotation)); }
public IActionResult Create(CarrierModel carrier) { bool actionSuccessfully = ModelState.IsValid; if (actionSuccessfully) { repositoryCarrier.setResource("carrier/"); CarrierModel carrierCreated = repositoryCarrier.create(carrier); TempData["newCarrier"] = serializeJSON(carrierCreated); TempData["registerSuccessfully"] = true; carrier = new CarrierModel { ids_Route = repositoryRoute.getAll().ToList() }; ModelState.Clear(); //return RedirectToAction(nameof(Details)); } // listar los datos necesarios para las relaciones de la clase Carrier ViewData["truckTypes"] = repositoryTruckType.getAll(); return(View(carrier)); //return RedirectToAction("DetalleChofer",carrier); // modificar }