Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id">Partner Id</param>
        /// <returns></returns>
        public IActionResult Home(int id)
        {
            if (!IsUserAllowedForPartner(id))
            {
                return(Unauthorized());
            }

            if (User.IsInRole(WebConstants.AdminRole))
            {
                var user = _userFactory.GetUser(User.Identity.Name);
                if (user.PartnerId != id)
                {
                    user.PartnerId = id;
                    _userFactory.UpdateUser(user);
                }
            }

            var model = _partnerFactory.GetPartnerForPartnerHomeView(id);

            return(View(model));
        }