Ejemplo n.º 1
0
        public ActionResult Success()
        {
            MyUser user = (MyUser)TempData["User"];

            ViewBag.Message = CompanyRegisterService.RegisterContractors((UserAccount)user);
            return(View());
        }
Ejemplo n.º 2
0
        public ActionResult Create([Bind(Include = "UserId,Login,Bik,Password,RePassword,Email,EmailElInvoice,IsLegalEntity,ContactNumbers,Bin,Kbe,CertSeries,CertNumber,CertDateIssue,Status,NameOrganization,User1CGuid,Surname,Name,Patronymic,AddressLegal,PhoneNumber")] LocaUser user)
        {
            if (ModelState.IsValid)
            {
                user.CreateDate = DateTime.Now;
                user.UpdateDate = DateTime.Now;
                try
                {
                    if (db.Users.Any(f => f.Login == user.Login))
                    {
                        ViewData["ErrorMessage"] = "Данный пользователь уже есть.";
                        return(View(user));
                    }

                    user.AddressPhysical.House  = user.AddressLegal.House;
                    user.AddressPhysical.Street = user.AddressLegal.Street;
                    UserAccount a = (UserAccount)user;
                    a.BankDetails[0] = new BankDetail()
                    {
                        Bik = "", CurrencyId = 1, AccountNumber = ""
                    };

                    user.PhoneNumber.PhoneCode   = "7";
                    user.PhoneNumber.PhoneTypeId = 1;
                    user.PhoneNumber.СountryСode = "727";
                    a.ContactNumbers[0]          = user.PhoneNumber;
                    ViewData["ErrorMessage"]     = CompanyRegisterService.RegisterContractors(a);
                    return(View(user));
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    ViewData["ErrorMessage"] = e.ToString();
                }

                return(RedirectToAction("Index"));
            }


            return(View(user));
        }