Пример #1
0
 public ActionResult Edit(VideoAlbumManageModel model)
 {
     ViewBag.SchoolID             = _sModel.SchoolID;
     model.VideoAlbum.IsPublished = false;
     if (model.VideoAlbum.SchoolID == 0)
     {
         model.VideoAlbum.SchoolID = _sModel.SchoolID;
     }
     if (ModelState.IsValid)
     {
         model.VideoAlbum.TransDate = DateTime.Now;
         model.VideoAlbum.UserID    = User.Identity.Name;
         string result = objAlbum.SaveVideoAlbum(model.VideoAlbum);
         if (result.Contains("Success"))
         {
             objSite.AddAuditLog("utblVideoAlbums", "Video Album Updated", IPAddressGetter.GetIPAddress(), User.Identity.Name);
             TempData["ErrMsg"] = result;
             return(RedirectToAction("index", "Videoalbum", new { Area = "Admin" }));
         }
         TempData["ErrMsg"] = result;
     }
     model.Components = objcomp.GetComponentList("");
     model.SchoolList = ObjSch.GetSchoolList("");
     return(View(model));
 }
        public ActionResult Add(CaseStudyManageModel model, HttpPostedFileBase docFile)
        {
            ViewBag.SchoolID = _sModel.SchoolID;
            if (model.CaseStudy.SchoolID == 0)
            {
                model.CaseStudy.SchoolID = _sModel.SchoolID;
            }
            var validData = true;

            if (docFile != null)
            {
                string fileResult = FileTypeCheck.IsValidFile(docFile, "File");
                if (!fileResult.Equals("Success"))
                {
                    ModelState.AddModelError("FileErr", fileResult);
                    validData = false;
                }
                else
                {
                    string file_result = SaveFile(docFile);
                    model.CaseStudy.CaseStudyFilePath = FileUrl + "CaseStudy/" + file_result;
                    if (file_result.Contains("Error"))
                    {
                        TempData["ErrMsg"] = file_result;
                        return(View(model));
                    }
                }
            }
            else
            {
                ModelState.AddModelError("FileErr", "Select Case Study file");
                validData = false;
            }
            if (ModelState.IsValid && validData)
            {
                model.CaseStudy.IsPublished = false;
                model.CaseStudy.TransDate   = DateTime.Now;
                model.CaseStudy.UserID      = User.Identity.Name;
                string result = objCaseStudy.SaveCaseStudy(model.CaseStudy);
                if (result.Contains("Success"))
                {
                    objSite.AddAuditLog("utblCaseStudies", "New Case Study Added", IPAddressGetter.GetIPAddress(), User.Identity.Name);
                    TempData["ErrMsg"] = result;
                    return(RedirectToAction("index", "casestudy", new { Area = "Admin" }));
                }
                else
                {
                    DeleteFile(model.CaseStudy.CaseStudyFilePath);
                    TempData["ErrMsg"] = result;
                }
            }
            model.Components = objcomp.GetComponentList("");
            model.SchoolList = ObjSch.GetSchoolList("");
            return(View(model));
        }
Пример #3
0
        private ActionResult RedirectToLocal(string returnUrl, string user = "")
        {
            Session["LoggedIN"] = true;
            objSite.AddAuditLog("", "User Login", IPAddressGetter.GetIPAddress(), user);

            if (Url.IsLocalUrl(returnUrl))
            {
                return(Redirect(returnUrl));
            }
            else
            {
                return(RedirectToAction("Dashboard", "User"));
            }
        }
Пример #4
0
        public ActionResult Edit(VideoSaveModel model, HttpPostedFileBase docFile)
        {
            utblVideo vid = new utblVideo();

            vid = objVideo.GetVideoByID(model.Videos.VideoID);
            string PrvPath     = vid.VideoFilePathDraft;
            string file_result = "";
            var    validData   = true;

            if (docFile != null)
            {
                string fileResult = FileTypeCheck.IsValidFile(docFile, "Video");
                if (!fileResult.Equals("Success"))
                {
                    ModelState.AddModelError("FileErr", fileResult);
                    validData = false;
                }
                else
                {
                    file_result = SaveFile(docFile, model.Videos.VideoAlbumID);
                    model.Videos.VideoFilePathDraft = FileUrl + "/Videos/" + file_result;
                    if (file_result.Contains("Error"))
                    {
                        TempData["ErrMsg"] = file_result;
                        return(View(model));
                    }
                }
            }
            if (ModelState.IsValid && validData)
            {
                //model.Videos.VideoAlbumID = model.VideoAlbum.VideoAlbumID;
                model.Videos.TransDate = DateTime.Now;
                model.Videos.UserID    = User.Identity.Name;
                string result = objVideo.SaveVideo(model.Videos);
                if (result.Contains("Success"))
                {
                    if (file_result != "")
                    {
                        DeleteFile(PrvPath);
                    }
                    objSite.AddAuditLog("utblVideos", "Videos Updated", IPAddressGetter.GetIPAddress(), User.Identity.Name);
                    TempData["ErrMsg"] = result;
                    return(RedirectToAction("index", "Video", new { Area = "Admin", AlbumID = model.Videos.VideoAlbumID }));
                }
                TempData["ErrMsg"] = result;
            }
            model.VideoAlbum = objVideoAlbum.GetVideoAlbumByID(model.Videos.VideoAlbumID);
            return(View(model));
        }
        //[AntiXSRFFilter]
        public ActionResult Edit(BannerSaveModel model, string sessionXSRFToken)
        {
            utblBanner banner = new utblBanner();

            banner = objBanner.GetBannerByID(model.Banner.BannerID);
            string PrvPath = banner.BannerPath;

            if (ModelState.IsValid)
            {
                string name = "";
                if (model.PhotoStrs.PhotoNormal != null)
                {
                    //if (!IsBase64(model.PhotoStrs.PhotoNormal))
                    //{
                    //    ModelState.AddModelError("PhotoStrs.PhotoNormal", "Invalid Photo");
                    //    return View(model);
                    //}
                    Random rand = new Random();
                    name = "Banner_" + DateTime.Now.ToString("yyyyMMdd") + "_" + rand.Next(50) + ".jpg";
                    string normal_result = SaveImage(model.PhotoStrs.PhotoNormal, name);
                    if (normal_result.Contains("Error"))
                    {
                        TempData["ErrMsg"] = normal_result;
                        return(View(model));
                    }
                    else
                    {
                        DeleteFile(PrvPath);
                    }
                    model.Banner.BannerPath  = "/Uploads/Banner/" + normal_result;
                    model.Banner.BannerThumb = model.PhotoStrs.PhotoThumb;
                }
                model.Banner.TransDate = DateTime.Now;
                model.Banner.UserID    = User.Identity.Name;
                //model.Banner.IPAddress = IPAddressGetter.GetIPAddress();

                string result = objBanner.SaveBanner(model.Banner);
                if (result.Contains("Success"))
                {
                    objSite.AddAuditLog("utblBanners", "Banner Updated", IPAddressGetter.GetIPAddress(), User.Identity.Name, model.Banner.BannerID);

                    TempData["ErrMsg"] = result;
                    return(RedirectToAction("index", "banner", new { Area = "Admin" }));
                }
                TempData["ErrMsg"] = result;
                DeleteFile(name);
            }
            return(View(model));
        }
Пример #6
0
        //[AntiXSRFFilter]
        public ActionResult Delete(long id)
        {
            string result = objcomp.DeleteComponent(id);

            if (!result.ToLower().Contains("error"))
            {
                objSite.AddAuditLog("utblMstComponent", "Component Removed", IPAddressGetter.GetIPAddress(), User.Identity.Name, id);
                TempData["ErrMsg"] = "Component Removed";
            }
            else
            {
                TempData["ErrMsg"] = result;
            }
            return(RedirectToAction("index", "component", new { Area = "Admin" }));
        }
Пример #7
0
        public ActionResult Delete(long id)
        {
            string result = objAlbum.DeleteVideoAlbum(id);

            if (!result.ToLower().Contains("Error"))
            {
                objSite.AddAuditLog("utblVideoAlbums", "Video Album Removed", IPAddressGetter.GetIPAddress(), User.Identity.Name, id);
                TempData["ErrMsg"] = "Success: Data Removed Succesfully !";
            }
            else
            {
                TempData["ErrMsg"] = result;
            }
            return(RedirectToAction("index", "Videoalbum", new { Area = "Admin" }));
        }
        public ActionResult Delete(long id)
        {
            string result = objTesti.DeleteTestimonial(id);

            if (!result.ToLower().Contains("error"))
            {
                objSite.AddAuditLog("utblTestimonials", "Testimonial Removed", IPAddressGetter.GetIPAddress(), User.Identity.Name, id);
                DeleteFile(result);
                TempData["ErrMsg"] = "Testimonial Removed";
            }
            else
            {
                TempData["ErrMsg"] = result;
            }
            return(RedirectToAction("index", "testimonial", new { Area = "Admin" }));
        }
Пример #9
0
        public static GameWorld World;          //Handles Physics simulations, entity AI, ingame interactions etc

        static void Main(string[] args)
        {
            //Fetch the local IPv4 address of the current machine being used to host the server
            string LocalIP = IPAddressGetter.GetLocalIPAddress();

            //Create an instance of Program and use that to start up the whole server application inside it
            Application = new Program();
            if (Application.StartServer(LocalIP))
            {
                Application.RunServer();
                Application.StopServer();
            }

            //Save and close the message output .log file before the application closes completely
            MessageLog.Close();
        }
Пример #10
0
 public ActionResult Add(MstComponentVM model)
 {
     if (ModelState.IsValid)
     {
         model.ComponentModel.UserID = User.Identity.Name;
         string result = objcomp.SaveComponent(model.ComponentModel);
         if (result.Contains("Success"))
         {
             objSite.AddAuditLog("utblMstComponents", "New Component Added", IPAddressGetter.GetIPAddress(), User.Identity.Name);
             TempData["ErrMsg"] = result;
             return(RedirectToAction("index", "component", new { Area = "Admin" }));
         }
         TempData["ErrMsg"] = result;
     }
     model.CategoryDDList = dalcategory.GetCategoryDD();
     return(View(model));
 }
        public ActionResult Add(TestimonialManageModel model)
        {
            ViewBag.SchoolID = _sModel.SchoolID;
            if (model.Testimonial.SchoolID == 0)
            {
                model.Testimonial.SchoolID = _sModel.SchoolID;
            }
            var validData = true;

            if (model.PhotoStrs.PhotoNormal == null)
            {
                ModelState.AddModelError("PhotoStrs.PhotoNormal", "Select a Photo");
                validData = false;
            }
            if (ModelState.IsValid && validData)
            {
                Random rand          = new Random();
                string name          = "T_Image_" + DateTime.Now.ToString("yyyyMMdd") + "_" + rand.Next(50) + ".jpg";
                string normal_result = SaveImage(model.PhotoStrs.PhotoNormal, name);
                if (normal_result.Contains("Error"))
                {
                    TempData["ErrMsg"] = normal_result;
                    return(View(model));
                }
                model.Testimonial.ImagePath   = FileUrl + "TestimonialImage/" + normal_result;
                model.Testimonial.IsPublished = false;
                model.Testimonial.TransDate   = DateTime.Now;
                model.Testimonial.UserID      = User.Identity.Name;
                string result = objTesti.SaveTestimonial(model.Testimonial);
                if (result.Contains("Success"))
                {
                    objSite.AddAuditLog("utblTestimonials", "New Tetimonial Added", IPAddressGetter.GetIPAddress(), User.Identity.Name);

                    TempData["ErrMsg"] = result;
                    return(RedirectToAction("index", "testimonial", new { Area = "Admin" }));
                }
                TempData["ErrMsg"] = result;
                return(RedirectToAction("index", "testimonial", new { Area = "Admin" }));
            }
            model.Components = objcomp.GetComponentList("");
            model.SchoolList = ObjSch.GetSchoolList("");
            return(View(model));
        }
        public ActionResult Add(MstSchoolManageModel model)
        {
            if (ModelState.IsValid)
            {
                model.School.TransDate = DateTime.Now;
                model.School.UserID    = User.Identity.Name;
                string result = objSchool.SaveSchool(model.School);
                if (result.Contains("Success"))
                {
                    objSite.AddAuditLog("utblMstSchools", "New School Added", IPAddressGetter.GetIPAddress(), User.Identity.Name);

                    TempData["ErrMsg"] = result;
                    return(RedirectToAction("index", "school", new { Area = "Admin" }));
                }
                TempData["ErrMsg"] = result;
                //return RedirectToAction("index", "school", new { Area = "Admin" });
            }
            model.DistList = objDist.GetDistrictList("");
            return(View(model));
        }
Пример #13
0
        //[AntiXSRFFilter]
        public ActionResult Delete(long id, long AlbumID)
        {
            utblVideo model = new utblVideo();

            model = objVideo.GetVideoByID(id);
            string PrvPath = model.VideoFilePathDraft;
            string result  = objVideo.DeleteVideo(id);

            if (!result.ToLower().Contains("Error"))
            {
                objSite.AddAuditLog("utblVideos", "Video Removed", IPAddressGetter.GetIPAddress(), User.Identity.Name, id);
                DeleteFile(PrvPath);
                TempData["ErrMsg"] = "Success: Data Removed Succesfully !";
            }
            else
            {
                TempData["ErrMsg"] = result;
            }
            return(RedirectToAction("index", "Video", new { Area = "Admin", AlbumID = AlbumID }));
        }
        //[AntiXSRFFilter]
        public ActionResult Edit(MstBlockManageModel model)
        {
            if (ModelState.IsValid)
            {
                model.Block.TransDate = DateTime.Now;
                model.Block.UserID    = User.Identity.Name;
                string result = objBlock.SaveBlock(model.Block);
                if (result.Contains("Success"))
                {
                    objSite.AddAuditLog("utblMstBlocks", "Block Updated", IPAddressGetter.GetIPAddress(), User.Identity.Name);

                    TempData["ErrMsg"] = result;
                    return(RedirectToAction("index", "block", new { Area = "Admin" }));
                }
                TempData["ErrMsg"] = result;
                //return RedirectToAction("index", "block", new { Area = "Admin" });
            }
            model.DistList = objDist.GetDistrictList("");
            return(View(model));
        }
        //[AntiXSRFFilter]
        public ActionResult Delete(long id, long AlbumID)
        {
            utblImage model = new utblImage();

            model = objImg.GetImageByID(id);
            string PrvPath = model.ImageFilePathNormal;
            string result  = objImg.DeleteImage(id);

            if (!result.ToLower().Contains("error"))
            {
                objSite.AddAuditLog("utblImages", "Image Removed", IPAddressGetter.GetIPAddress(), User.Identity.Name, id);
                DeleteFile(PrvPath);
                TempData["ErrMsg"] = "Success: Data Removed Succesfully !";
            }
            else
            {
                TempData["ErrMsg"] = result;
            }
            return(RedirectToAction("index", "image", new { Area = "Admin", AlbumID = AlbumID }));
        }
        public ActionResult Delete(long id)
        {
            utblBanner banner = new utblBanner();

            banner = objBanner.GetBannerByID(id);
            string PrvPath = banner.BannerPath;
            string result  = objBanner.DeleteBanner(id);

            if (!result.ToLower().Contains("error"))
            {
                objSite.AddAuditLog("utblBanners", "Banner Removed", IPAddressGetter.GetIPAddress(), User.Identity.Name, id);
                DeleteFile(PrvPath);
                TempData["ErrMsg"] = "Success: Data Removed Succesfully !";
            }
            else
            {
                TempData["ErrMsg"] = result;
            }

            return(RedirectToAction("index", "banner", new { Area = "Admin" }));
        }
        //[AntiXSRFFilter]
        public ActionResult Add(BannerSaveModel model, string sessionXSRFToken)
        {
            var validData = true;

            if (model.PhotoStrs.PhotoNormal == null)
            {
                ModelState.AddModelError("PhotoStrs.PhotoNormal", "Select a Photo");
                validData = false;
            }
            //else if (!IsBase64(model.PhotoStrs.PhotoNormal))
            //{
            //    ModelState.AddModelError("PhotoStrs.PhotoNormal", "Invalid Photo");
            //    validData = false;
            //}
            if (ModelState.IsValid && validData)
            {
                Random rand          = new Random();
                string name          = "Banner_" + DateTime.Now.ToString("yyyyMMdd") + "_" + rand.Next(50) + ".jpg";
                string normal_result = SaveImage(model.PhotoStrs.PhotoNormal, name);
                if (normal_result.Contains("Error"))
                {
                    TempData["ErrMsg"] = normal_result;
                    return(View(model));
                }
                model.Banner.BannerPath  = "/Uploads/Banner/" + normal_result;
                model.Banner.TransDate   = DateTime.Now;
                model.Banner.UserID      = User.Identity.Name;
                model.Banner.BannerThumb = model.PhotoStrs.PhotoThumb;
                string result = objBanner.SaveBanner(model.Banner);
                if (result.Contains("Success"))
                {
                    objSite.AddAuditLog("utblBanners", "New Banner Added", IPAddressGetter.GetIPAddress(), User.Identity.Name);
                    TempData["ErrMsg"] = result;
                    return(RedirectToAction("index", "banner", new { Area = "Admin" }));
                }
                TempData["ErrMsg"] = result;
                DeleteFile(name);
            }
            return(View(model));
        }
        public ActionResult Edit(ImageSaveModel model)
        {
            utblImage img = new utblImage();

            img = objImg.GetImageByID(model.Images.ImageID);
            string PrvPath = img.ImageFilePathNormal;

            if (ModelState.IsValid)
            {
                string name = "";
                if (model.PhotoStrs.PhotoNormal != null)
                {
                    Random rand = new Random();
                    name = "Images_" + DateTime.Now.ToString("yyyyMMdd") + "_" + rand.Next(50) + ".jpg";
                    string normal_result = SaveImage(model.PhotoStrs.PhotoNormal, name);
                    if (normal_result.Contains("Error"))
                    {
                        TempData["ErrMsg"] = normal_result;
                        return(View(model));
                    }
                    model.Images.ImageFilePathNormal = "/Uploads/Images/" + normal_result;
                    model.Images.ImageFilePathThumb  = model.PhotoStrs.PhotoThumb;
                }
                model.Images.TransDate = DateTime.Now;
                model.Images.UserID    = User.Identity.Name;
                string result = objImg.SaveImage(model.Images);
                if (result.Contains("Success"))
                {
                    DeleteFile(PrvPath);
                    objSite.AddAuditLog("utblImages", "Image Updated", IPAddressGetter.GetIPAddress(), User.Identity.Name);
                    TempData["ErrMsg"] = result;
                    return(RedirectToAction("index", "image", new { Area = "Admin", AlbumID = model.Images.ImageAlbumID }));
                }
                TempData["ErrMsg"] = result;
                //return RedirectToAction("index", "image", new { Area = "Admin", AlbumID = model.Images.ImageAlbumID });
            }
            return(View(model));
        }
        public ActionResult Add(ImageSaveModel model)
        {
            var validData = true;

            if (model.PhotoStrs.PhotoNormal == null)
            {
                ModelState.AddModelError("PhotoStrs.PhotoNormal", "Please Upload the Image field Cannot be empty!");
                validData = false;
            }
            if (ModelState.IsValid && validData)
            {
                Random rand          = new Random();
                string name          = "Image_" + DateTime.Now.ToString("yyyyMMdd") + "_" + rand.Next(50) + ".jpg";
                string normal_result = SaveImage(model.PhotoStrs.PhotoNormal, name);
                if (normal_result.Contains("Error"))
                {
                    TempData["ErrMsg"] = normal_result;
                    return(View(model));
                }
                model.Images.ImageAlbumID        = model.ImageAlbum.ImageAlbumID;
                model.Images.ImageFilePathNormal = "/Uploads/Images/" + normal_result;
                model.Images.TransDate           = DateTime.Now;
                model.Images.UserID             = User.Identity.Name;
                model.Images.ImageFilePathThumb = model.PhotoStrs.PhotoThumb;

                string result = objImg.SaveImage(model.Images);
                if (result.Contains("Success"))
                {
                    objSite.AddAuditLog("utblImages", "New Image Added", IPAddressGetter.GetIPAddress(), User.Identity.Name);

                    TempData["ErrMsg"] = result;
                    return(RedirectToAction("index", "image", new { Area = "Admin", AlbumID = model.ImageAlbum.ImageAlbumID }));
                }
                TempData["ErrMsg"] = result;
                //return RedirectToAction("index", "image", new { Area = "Admin", AlbumID = model.ImageAlbum.ImageAlbumID });
            }
            return(View(model));
        }
        public ActionResult Delete(long id)
        {
            utblCaseStudie cs = new utblCaseStudie();

            cs = objCaseStudy.GetCaseStudyByID(id);
            string         PrvPath = cs.CaseStudyFilePath;
            utblCaseStudie model   = new utblCaseStudie();

            model = objCaseStudy.GetCaseStudyByID(id);
            string result = objCaseStudy.DeleteCaseStudy(id);

            if (!result.ToLower().Contains("Error"))
            {
                objSite.AddAuditLog("utblCaseStudies", "Case Study Removed", IPAddressGetter.GetIPAddress(), User.Identity.Name, id);
                DeleteFile(model.CaseStudyFilePath);
                TempData["ErrMsg"] = "Success: Data Removed Succesfully !";
            }
            else
            {
                TempData["ErrMsg"] = result;
            }
            return(RedirectToAction("index", "casestudy", new { Area = "Admin" }));
        }
 public ActionResult Edit(MstSubComponentManageModel model)
 {
     if (ModelState.IsValid)
     {
         model.SubComponent.TransDate = DateTime.Now;
         model.SubComponent.UserID    = User.Identity.Name;
         string result = objSubcomp.SaveSubComponent(model.SubComponent);
         if (result.Contains("Success"))
         {
             objSite.AddAuditLog("utblMstSubComponents", "New SubComponent Updated", IPAddressGetter.GetIPAddress(), User.Identity.Name);
             TempData["ErrMsg"] = result;
             return(RedirectToAction("index", "subcomponent", new { Area = "Admin" }));
         }
         TempData["ErrMsg"] = result;
         //return RedirectToAction("index", "subcomponent", new { Area = "Admin" });
     }
     model.ComponentList = objComp.GetComponentList("");
     return(View(model));
 }
Пример #22
0
        public ActionResult Edit(utblMstCompCategorie model)
        {
            if (ModelState.IsValid)
            {
                model.UserID = User.Identity.Name;
                string result = objdal.SaveCategory(model);
                if (result.Contains("Success"))
                {
                    objSite.AddAuditLog("utblMstCompCategories", "New Component Categorys Updated", IPAddressGetter.GetIPAddress(), User.Identity.Name);

                    TempData["ErrMsg"] = result;
                    return(RedirectToAction("Categorylist", "CompCategory", new { Area = "Admin" }));
                }
                TempData["ErrMsg"] = result;
            }
            return(View(model));
        }
Пример #23
0
        public async Task <ActionResult> Register(RegisterUserManageModel model)
        {
            ApplicationDbContext context = new ApplicationDbContext();
            var UserManager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(context));
            var roleManager = new RoleManager <IdentityRole>(new RoleStore <IdentityRole>(context));

            UserManager.UserValidator = new UserValidator <ApplicationUser>(UserManager)
            {
                AllowOnlyAlphanumericUserNames = false
            };

            if (ModelState.IsValid)
            {
                var user = new ApplicationUser
                {
                    UserName             = model.Register.Name,
                    Email                = model.Register.Email,
                    PhoneNumber          = model.Register.PhoneNumber,
                    Designation          = model.Register.Designation,
                    Gender               = model.Register.Gender,
                    SchoolID             = model.Register.SchoolID,
                    PhoneNumberConfirmed = true,
                    EmailConfirmed       = true,
                    IsActive             = true,
                    RegDate              = DateTime.Now
                };
                var result = await UserManager.CreateAsync(user, model.Register.Email);

                if (result.Succeeded)
                {
                    //await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
                    //update in audit table
                    objSite.AddAuditLog("AspNetUsers", user.UserName + " record added", IPAddressGetter.GetIPAddress(), User.Identity.Name);
                    var result1 = UserManager.AddToRole(user.Id, "SchoolAdmin");
                    if (result1.Succeeded)
                    {
                        objSite.AddAuditLog("AspNetUserRoles", user.UserName + " role record added", IPAddressGetter.GetIPAddress(), User.Identity.Name);


                        //send registration email
                        utblTrnMessage Item = new utblTrnMessage();
                        Item.IsNew          = true;
                        Item.MessageDate    = DateTime.Now;
                        Item.MessageSubject = "School Admin Registration";
                        Item.MessageBody    = "Dear " + model.Register.Name + "," + "\nYou have been successfully registered as a school admin for the Sikkim Shagun Portal.\nYour Login credientials:\nUsername: "******"\nPassword: "******"\n\nRegards,\n" + "Sikkim Shagun\nGovernment of Sikkim.";
                        Item.SMSContent     = "";
                        Item.SentTo         = model.Register.Email;
                        Item.ServiceDtlID   = 0;
                        Item.RefTable       = "";
                        Item.RefTransID     = "";
                        Item.SentBy         = "SikkimShagun";
                        Item.TransStatus    = "";
                        Item.TransRemarks   = "Registered on" + DateTime.Now;

                        SendMail objMailDAL = new SendMail();
                        bool     res        = objMailDAL.SendEmail(Item);


                        //int MailStatus = SendEmailConfirmationToken(user.Id, "Confirm your account", user.Email, TempPassword);
                        //return RedirectToAction("adminuserlist");
                    }

                    TempData["ErrMsg"] = user.UserName + " record updated";
                    return(RedirectToAction("UserList", "User", new { Area = "" }));
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Пример #24
0
        public async Task <ActionResult> EditRegister(RegisterUserManageModel model)
        {
            var user = await UserManager.FindByIdAsync(model.EditRegister.id);

            if (ModelState.IsValid)
            {
                user.UserName    = model.EditRegister.Name;
                user.PhoneNumber = model.EditRegister.PhoneNumber;
                user.Designation = model.EditRegister.Designation;
                user.Gender      = model.EditRegister.Gender;
                user.SchoolID    = model.EditRegister.SchoolID;

                var Result = await UserManager.UpdateAsync(user);

                if (Result.Succeeded)
                {
                    objSite.AddAuditLog("AspNetUsers", user.UserName + " record updated", IPAddressGetter.GetIPAddress(), User.Identity.Name);

                    TempData["ErrMsg"] = user.UserName + " record updated";
                    return(RedirectToAction("UserList", "account"));
                }
                AddErrors(Result);
            }
            return(View(model));
        }