Esempio n. 1
0
        public JsonResult CreateCustomer(CreateCustomerVM vm)
        {
            try
            {
                Customer newCustomer = new Customer();
                newCustomer.Created    = DateTime.Now;
                newCustomer.CreatedBy  = SessionManager.ActiveUser.Id;
                newCustomer.Modified   = DateTime.Now;
                newCustomer.ModifiedBy = SessionManager.ActiveUser.Id;
                newCustomer.IsActive   = true;

                newCustomer.CompanyName = vm.CompanyName;
                newCustomer.Contact     = vm.Contact;
                newCustomer.Caption     = vm.Caption;
                newCustomer.City        = vm.City;
                newCustomer.District    = vm.District;
                newCustomer.Email       = vm.Email;
                newCustomer.Phone       = vm.Phone;
                newCustomer.Description = vm.Description;

                _cus.Insert(newCustomer);

                return(Json(new { Result = true, Message = "Müşteri Başarıyla Kaydedildi." }));
            }
            catch (Exception ex)
            {
                return(Json(new { Result = false, ex.Message }));
            }
        }
        internal void AddCustomerToDB(CreateCustomerVM model, string hashId)
        {
            var newCust = Mapper.Map <Customer>(model);

            newCust.UserHashId = hashId;
            Customer.Add(newCust);
            SaveChanges();
        }
Esempio n. 3
0
        /// <summary>
        /// Creates a new customer
        /// </summary>
        /// <returns></returns>
        public ActionResult CreateCustomer(CreateCustomerVM createCustomerVM)
        {
            var postCustomer = new Fusebill.ApiWrapper.Dto.Post.Customer
            {
                FirstName         = createCustomerVM.firstName,
                LastName          = createCustomerVM.lastName,
                PrimaryEmail      = createCustomerVM.primaryEmail,
                PrimaryPhone      = createCustomerVM.primaryPhone,
                CompanyName       = createCustomerVM.companyName,
                Reference         = createCustomerVM.reference,
                CustomerReference = new ApiWrapper.Dto.Get.CustomerReference {
                    Reference1 = createCustomerVM.customerReference,
                }
            };

            var returnedCustomer = ApiClient.PostCustomer(postCustomer);

            return(Json(returnedCustomer));
        }
 public IActionResult Create(CreateCustomerVM model)
 {
     context.AddCustomerToDB(model, GetCurrentUserID());
     TempData[nameof(CreateCustomerVM.Name)] = model.Name;
     return(RedirectToAction(nameof(CustomersController.Create)));
 }