示例#1
0
        public ActionResult RegisterVIP()
        {
            BLL.BLLDepartment bllDepartment = new BLL.BLLDepartment();
            ViewBag.Department = bllDepartment.GetAllDepartment().Where(u => u.CompanyId == CompanyController.companyId).ToList();


            //The Below codes are written to display the Company name in the navigation Bar
            BLL.BLLCompany bllCompany = new BLL.BLLCompany();
            string         id         = System.Web.HttpContext.Current.User.Identity.GetUserId();
            var            lst        = bllCompany.GetAllCompany().Where(u => u.UserId == id).FirstOrDefault();

            ViewBag.Companyname = lst.Name;


            return(View());
        }
示例#2
0
        public async Task <ActionResult> RegisterCompany(BO.BOCompany model)
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser {
                    UserName = model.Email, Email = model.Email
                };
                var result = await UserManager.CreateAsync(user, model.password);

                if (result.Succeeded)
                {
                    //Temp COde by yogesh gautam
                    var currentUser = UserManager.FindByName(user.UserName);
                    var roleresult  = UserManager.AddToRole(currentUser.Id, "CompanyMaster");
                    //  await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);

                    //creating VIP
                    string             filename = "";
                    HttpPostedFileBase fup      = Request.Files[0];
                    if (fup != null)
                    {
                        filename = Guid.NewGuid() + fup.FileName;
                        fup.SaveAs(Server.MapPath("~/Images/" + (Guid.NewGuid() + fup.FileName)));
                    }
                    BLL.BLLCompany vlcompany = new BLL.BLLCompany();
                    model.Photo  = filename;
                    model.UserId = user.Id;

                    vlcompany.CreateCompany(model);

                    return(RedirectToAction("Index", "Software"));
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }