コード例 #1
0
ファイル: CompanyController.cs プロジェクト: wladcy/Distance
        public ActionResult UpdateCompany()
        {
            var userName = User.Identity.Name;
            ApplicationUserManager userManager = HttpContext.GetOwinContext().GetUserManager <ApplicationUserManager>();
            var user             = userManager.FindByName(userName);
            CompanyViewModel  cc = new CompanyViewModel();
            DatabaseControler dc = new DatabaseControler();

            dc.GetCompany(ref cc, user.Id);
            return(View(cc));
        }
コード例 #2
0
ファイル: CompanyController.cs プロジェクト: wladcy/Distance
        public ActionResult Index(CompanytMessageId?message)
        {
            ViewBag.StatusMessage =
                message == CompanytMessageId.UpdateCompanySuccess ? "Dane firmy zostały zapisane w bazie." : "";
            var userName = User.Identity.Name;
            ApplicationUserManager userManager = HttpContext.GetOwinContext().GetUserManager <ApplicationUserManager>();
            var user            = userManager.FindByName(userName);
            CompanyViewModel cc = new CompanyViewModel();

            if (userManager.GetRoles(user.Id).Contains("ADMINISTRATOR"))
            {
                cc.IsAdministrator = true;
            }
            cc.IsAccountConfirmed = user.EmailConfirmed;
            DatabaseControler dc = new DatabaseControler();

            dc.GetCompany(ref cc, user.Id);
            return(View(cc));
        }