public JsonResult Update(SupplierDetailView vm) { GetSupplierRequest request = new GetSupplierRequest(); request.SupplierID = vm.SupplierID; ModifySupplierRequest updateRequest = _supplierService.GetSupplier(request).Supplier.ConvertToModifySupplierRequest(); updateRequest.SupplierID = vm.SupplierID; updateRequest.CompanyName = vm.CompanyName; updateRequest.ContactName = vm.ContactName; updateRequest.ContactTitle = vm.ContactTitle; updateRequest.Address = vm.Address; updateRequest.City = vm.City; updateRequest.Region = vm.Region; updateRequest.PostalCode = vm.PostalCode; updateRequest.Country = vm.Country; updateRequest.Phone = vm.Phone; updateRequest.Fax = vm.Fax; updateRequest.HomePage = vm.HomePage; ModifySupplierResponse response = _supplierService.ModifySupplier(updateRequest); return(Json(response)); }
public JsonResult GetDetail(System.Int32 id) { SupplierDetailView vm = new SupplierDetailView(); GetSupplierRequest request = new GetSupplierRequest(); request.SupplierID = id; GetSupplierResponse response = _supplierService.GetSupplier(request); if (response.SupplierFound) { vm = response.Supplier.ConvertToSupplierDetailView(); } return(Json(vm, JsonRequestBehavior.AllowGet)); }
public IActionResult SaveSupplierDetail(SupplierDetailView viewModel) { var accountModel = HttpContext.Session .GetObjectFromJson <AccountDetailView>("AccountDetailView"); if (accountModel.UserDetail == null) { accountModel.SupplierDetail = new SupplierDetailView(); } accountModel.SupplierDetail = viewModel; HttpContext.Session.SetObjectAsJson("AccountDetailView", accountModel); return(RedirectToAction("Confirmation")); }
public IActionResult AddSupplierDetail() { var userDetail = HttpContext.Session .GetObjectFromJson <AccountDetailView>("AccountDetailView").UserDetail; if (UserType.SUPPLIER != userDetail.UserType) { return(RedirectToAction("Confirmation")); } var viewModel = new SupplierDetailView { CountryList = _unitOfWork.CountriesRepository.Items.ToList(), StateList = _unitOfWork.StatesRepository.Items.ToList() }; return(View(viewModel)); }
public JsonResult Create(SupplierDetailView vm) { CreateSupplierRequest request = new CreateSupplierRequest(); request.CompanyName = vm.CompanyName; request.ContactName = vm.ContactName; request.ContactTitle = vm.ContactTitle; request.Address = vm.Address; request.City = vm.City; request.Region = vm.Region; request.PostalCode = vm.PostalCode; request.Country = vm.Country; request.Phone = vm.Phone; request.Fax = vm.Fax; request.HomePage = vm.HomePage; CreateSupplierResponse response = _supplierService.CreateSupplier(request); return(Json(response)); }