public void SaveResourceFile(string resourceToken, HttpPostedFile postedFile)
        {
            var extension = System.IO.Path.GetExtension(postedFile.FileName);
            var fileName  = BusinessLayerParameters.UserDocumentFolderPrefix + Guid.NewGuid().ToString() + extension;
            var filePath  = HttpContext.Current.Server.MapPath(fileName);

            postedFile.SaveAs(filePath);
            var resource = db.ResourcesReferences.FirstOrDefault(s => s.TokenValue == resourceToken);

            if (resource != null)
            {
                resource.FileExtension = extension;
                resource.ResourceUrl   = fileName;
                db.SaveChanges();
            }
        }
        public ActionResult AdviserApprove(string id)
        {
            var adviser = db.Advisers.SingleOrDefault(s => s.AdviserNumber == id);

            adviser.VerifiedId = BusinessLayerParameters.verificationStatus_Verified;



            UserManager.RemoveFromRole(id, AuthorizationRoles.Role_Preadviser);
            UserManager.AddToRole(id, AuthorizationRoles.Role_Adviser);

            UserManager.RemoveClaim(id, UserManager.GetClaimsAsync(id).Result[0]);
            UserManager.AddClaim(id, new Claim(AuthorizationClaims.ClaimType_VerificationStatus, AuthorizationClaims.ClaimValue_VerificationStatus_Verified));

            db.SaveChanges();
            TempData["success"] = "Adviser has been successfully verified";
            return(RedirectToAction("PendingProfiles"));
        }
 public void Save()
 {
     db.SaveChanges();
 }