예제 #1
0
        public async Task <IActionResult> SOVendorEdit(ProvideModel model)
        {
            var provider = await _workorderService.GetProvider((int)model.Scid);

            if (provider == null)
            {
                return(RedirectToAction("SOVendor2"));
            }

            if (ModelState.IsValid)
            {
                var result = await _workorderService.UpdateProvider(provider, model);

                if (result != null)
                {
                    SuccessNotification("provider data has been updated successfully.");
                    return(RedirectToAction("SOVendorEdit", "WorkOrders",
                                            new { Scid = model.Scid }));
                }
                else
                {
                    ModelState.AddModelError("", "Something went wrong while updating record");
                }
            }

            return(View(model));
        }
예제 #2
0
        public async Task <IActionResult> SOVendorAdd()
        {
            var model = new ProvideModel();

            var categories = await _workorderService.GetClientCategories((int)_workContext.CurrentCustomer.ClientId);

            model.AvailableCategories.Add(new SelectListItem {
                Text = "Select Category", Value = "0"
            });
            foreach (var item in categories)
            {
                model.AvailableCategories.Add(new SelectListItem {
                    Text = item.Category, Value = item.Category
                });
            }

            return(View(model));
        }
예제 #3
0
        public async Task <IActionResult> SOVendorAdd(ProvideModel model)
        {
            if (ModelState.IsValid)
            {
                var scObj = _mapper.Map <ServiceContracts>(model);
                scObj.ClientId = (int)_workContext.CurrentCustomer.ClientId;

                var result = await _workorderService.InsertProvider(scObj);

                if (result != null)
                {
                    SuccessNotification("Provider data has been saved successfully.");
                    return(RedirectToAction("SOVendorAdd"));
                }
                else
                {
                    ModelState.AddModelError("", "Something went wrong while saving new Provider record");
                }
            }

            return(View(model));
        }
예제 #4
0
        public async Task <ServiceContracts> UpdateProvider(ServiceContracts serviceContracts, ProvideModel model)
        {
            serviceContracts.Category = model.Category;
            serviceContracts.Scvendor = model.Scvendor;
            serviceContracts.Scadd1   = model.Scadd1;
            serviceContracts.Scadd2   = model.Scadd2;
            serviceContracts.Sccity   = model.Sccity;
            serviceContracts.Scstate  = model.Scstate;
            serviceContracts.Sczip    = model.Sczip;
            serviceContracts.Scphone1 = model.Scphone1;
            serviceContracts.Scfax    = model.Scfax;

            serviceContracts.AccountNo       = model.AccountNo;
            serviceContracts.ContractNo      = model.ContractNo;
            serviceContracts.ScvendorContact = model.ScvendorContact;
            serviceContracts.SccontactEmail  = model.SccontactEmail;
            serviceContracts.SalesTaxYesNo   = Convert.ToBoolean(model.SalesTaxYesNo);
            serviceContracts.VsalesTax       = model.VsalesTax;

            serviceContracts = await _serviceContractRepository.UpdateAsync(serviceContracts);

            return(serviceContracts);
        }