Esempio n. 1
0
 public ActionResult Edit(CustomerModel vm)
 {
     vm.ResponseCustomer = new CustomerService().UpdateCustomer(new AddCustomerRequest()
     {
         Customer = vm.Convert()
     });
     if (vm.ResponseCustomer.IsSuccess)
     {
         ViewBag.Message = "编辑成功!";
     }
     ApplicationConfigHelper.RefreshProjectUserCustomers();
     ApplicationConfigHelper.RefreshApplicationCustomers();
     return(RedirectToAction("List"));
 }
Esempio n. 2
0
        public ServiceResponse <CustomerModel> UpdateCustomer(CustomerModel newCustomer)
        {
            try
            {
                var newCustomer2 = newCustomer.Convert <Customer>();

                var asd = _customerService.UpdateCustomer(newCustomer2);

                return(new ServiceResponse <CustomerModel>(newCustomer, true, 100, "Order başarılı"));
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Esempio n. 3
0
        public ActionResult Create(CustomerModel vm)
        {
            CustomerService  service  = new CustomerService();
            IList <Customer> customer = new List <Customer>();

            var segments = new SegmentService().GetSegmentsByCondition(new GetSegmentsByConditionRequest()
            {
                Name = "", State = true
            }).Result;

            vm.Segments = segments.Select(s => new SelectListItem()
            {
                Value = s.ID.ToString(), Text = s.Name + "------>>详情>>" + s.Description
            });
            vm.Types = vm.StoreStatus > 0 ? 1 : 0;
            customer.Add(vm.Convert());
            Response <IEnumerable <Customer> > response = service.AddCustomer(new AddCustomerRequest()
            {
                customers = customer
            }, base.UserInfo.ID.ToString(), base.UserInfo.Name, (int)base.UserInfo.ProjectID, vm.SelectedCustomerOrShipperSegment.ToString() == "" ? 0 : (int)vm.SelectedCustomerOrShipperSegment);

            if (vm.ID > 0)
            {
                Customer cus = service.selectCustomer((int)vm.ID);
                vm.ConvertDesc(cus);
            }

            if (response.IsSuccess)
            {
                ApplicationConfigHelper.RefreshApplicationCustomers();
                ApplicationConfigHelper.RefreshGetApplicationCustomer();
                ApplicationConfigHelper.RefreshCustomers();
                if (vm.StoreType > 1)
                {
                    ViewBag.Message = response.Result.Select(c => c.ID).FirstOrDefault().ToString();
                }
                else
                {
                    ViewBag.Message = "0";
                }
            }
            return(View(vm));
        }