Пример #1
0
        //[Authorize(Roles = "Admin,Client")]
        public ActionResult MyProfile(CorporateProfile MyProfile)
        {
            UserViewModel userdetails = generic.GetUserDetail(User.Identity.GetUserId());

            ViewBag.UserId = userdetails.SubscriberId;
            //If Client has team members with all rights
            if (userdetails.CorporateId != null && userdetails.CorporateId != userdetails.SubscriberId)
            {
                var  TeamDetails = cms.GetTeamMember(userdetails.CorporateId, User.Identity.GetUserId()).FirstOrDefault();
                bool result      = cms.AddTeamMember(User.Identity.GetUserId(), userdetails.CorporateId, userdetails.SubscriberId, MyProfile.Name, MyProfile.AlternateEmail, MyProfile.AlternateContact, TeamDetails.EmpRoleId, TeamDetails.Designation, DateTime.UtcNow, User.Identity.GetUserId());
                return(RedirectToAction("MyProfile", "Dashboard", new { area = "CMS", status = result }));
            }
            else
            {
                bool result = cms.AddCorporateProfile(userdetails.UserId, MyProfile.Name, MyProfile.AlternateContact, MyProfile.AlternateEmail, MyProfile.Nationality, MyProfile.DepartmentId, MyProfile.SubscriberId, DateTime.UtcNow, userdetails.UserId);

                if (!string.IsNullOrEmpty(MyProfile.CorporateId))
                {
                    foreach (string file in Request.Files)
                    {
                        HttpPostedFileBase attachment = Request.Files[file] as HttpPostedFileBase;
                        cms.uploadLogo(MyProfile.CorporateId, attachment);
                    }
                }
                return(RedirectToAction("MyProfile", "Dashboard", new { area = "CMS", status = result }));
            }
        }