示例#1
0
 public IActionResult Create(CustomerCreateVM createVM)
 {
     if (!ModelState.IsValid)
     {
         return(View(createVM));
     }
     _command.Create(createVM);
     return(RedirectToAction("List"));
 }
        public ActionResult Create(CustomerCreateVM vm)
        {
            if (ModelState.IsValid)
            {
                return(Redirect("Index"));
            }

            return(View("Create", vm));
        }
        public ActionResult customerCreate()
        {
            CustomerCreateVM customerCreateVM = new CustomerCreateVM();

            customerCreateVM.scheduleList = GetScheduleList();
            customerCreateVM.countryList  = GetCountryCode();

            //ViewBag.schedule_name = new SelectList(db.Schedules, "schedule_id", "schedule_name");
            return(View(customerCreateVM));
        }
示例#4
0
        public IActionResult Create(CustomerCreateVM customer)
        {
            if (ModelState.IsValid)
            {
                var model = _mapper.Map <Customer>(customer);
                _unitOfWork.Customer.Add(model);
            }

            return(RedirectToAction("Index"));
        }
        public void Create(CustomerCreateVM createVM)
        {
            _customer.FirstName = createVM.FirstName;
            _customer.LastName  = createVM.LastName;
            _customer.UserName  = createVM.UserName;
            _customer.Password  = createVM.Password;

            _context.Add(_customer);
            _context.SaveChanges();
        }
 public ActionResult Create(CustomerCreateVM customerCreateVM)
 {
     try
     {
         var customer = _mapper.Map <Dozen2Models.Customer>(customerCreateVM);
         _customerBL.AddCustomer(customer);
         return(RedirectToAction(nameof(Index)));
     }
     catch
     {
         return(View());
     }
 }
        public ActionResult customerCreate(CustomerCreateVM customerCreateVM)
        {
            var model = new Customer
            {
                customer_name    = customerCreateVM.customer_name,
                customer_surname = customerCreateVM.customer_surname,
                customer_address = customerCreateVM.customer_address,
                customer_phone   = customerCreateVM.customer_phone + Request.Form["codeNum"] + Request.Form["thirdNum"] + Request.Form["fourthNum"],
                schedule_id      = customerCreateVM.schedule_id
            };

            db.Customers.Add(model);
            db.SaveChanges();
            return(RedirectToAction("customerDetail"));
        }
示例#8
0
        public async Task <ActionResult> Create(CustomerCreateVM model)
        {
            RolesBusiness rb = new RolesBusiness();

            if (ModelState.IsValid)
            {
                var user = new ApplicationUser {
                    UserName = model.Email, Email = model.Email, PhoneNumber = model.phone, EmailConfirmed = true
                };
                var adminresult = await UserManager.CreateAsync(user, model.Password);

                //cb.add(model);

                if (adminresult.Succeeded)
                {
                    ApplicationDbContext db = new ApplicationDbContext();
                    rb.AddUserToRole(db.Users.FirstOrDefault(x => x.UserName == model.Email).Id, WebConstants.CustomerRole);

                    // await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
                    string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);

                    var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code }, protocol: Request.Url.Scheme);
                    var client      = new SendGridClient("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");
                    var from        = new EmailAddress("*****@*****.**", "MontClair Veterinary");
                    var subject     = "Confirm your account";
                    var to          = new EmailAddress(model.Email, model.FirstName + " " + model.LastName);
                    var htmlContent = "Hello " + model.FirstName + " " + model.LastName + ", Kindly confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>";
                    var msg         = MailHelper.CreateSingleEmail(from, to, subject, null, htmlContent);
                    var response    = client.SendEmailAsync(msg);
                }

                //Success(string.Format("<b>{0}</b> was successfully added to the database.", model.FirstName), true);
                return(RedirectToAction("Create"));
            }

            return(View(model));
        }
 public CustomerCreatePage()
 {
     InitializeComponent();
     DataContext = new CustomerCreateVM();
 }
示例#10
0
        public IActionResult Create()
        {
            var customer = new CustomerCreateVM();

            return(View(customer));
        }