public ActionResult RemoveProfile()
        {
            BusinessLayerResult <EveryNoteUser> res = everynoteuser_mngr.RemoveUserById(CurrentSession.User.Id);

            if (res.Errors.Count > 0)
            {
                ErrorViewModel error_notifyobj = new ErrorViewModel()
                {
                    Items          = res.Errors,
                    title          = "Your profile did not delete!",
                    text           = "Please contact the management!",
                    RedirectingUrl = "/Home/ShowProfile"
                };

                return(View("Error", error_notifyobj));
            }

            Session.Clear();

            //return RedirectToAction("Index");

            SuccessfulOperationsViewModel successful_notifyobj = new SuccessfulOperationsViewModel()
            {
                title          = "Your account has been deleted.",
                text           = "If you accidentally deleted your account, please contact us.",
                RedirectingUrl = "/Home/Index"
            };

            successful_notifyobj.Items.Add("If you do not make a request within 30 days, your account will be permanently deleted.");

            return(View("SuccessfulOperation", successful_notifyobj));
        }
        public ActionResult UserActivate(Guid id)
        {
            BusinessLayerResult <EveryNoteUser> res = everynoteuser_mngr.ActivateUser(id);

            if (res.Errors.Count > 0)
            {
                ErrorViewModel error_notifyobj = new ErrorViewModel()
                {
                    title = "Invalid Operation!",
                    text  = "Your process was rejected by the system!",
                    Items = res.Errors
                };

                return(View("Error", error_notifyobj));
            }

            SuccessfulOperationsViewModel successful_notifyobj = new SuccessfulOperationsViewModel()
            {
                title          = "Your activation is successful.",
                text           = "Please login to the system using your user information.",
                RedirectingUrl = "/Home/SignIn"
            };

            successful_notifyobj.Items.Add("If your activation mail does not arrive you can use the help menu.");
            return(View("SuccessfulOperation", successful_notifyobj));
        }
        public ActionResult SignUp(SignUpViewModel model)
        {
            if (ModelState.IsValid) //Gelen verilerin Modeldeki propertylere uygunlugunu kontrol eder burada modelimiz 'SignUpViewModel' dir.
            {
                BusinessLayerResult <EveryNoteUser> res = everynoteuser_mngr.SignUpUser(model);

                if (res.Errors.Count > 0)
                {
                    res.Errors.ForEach(x => ModelState.AddModelError("", x.Message)); //Tüm Errors List inde Foreach ile dön herbiri için ilgili string i (x yani) ModelState in Error üne ekle.
                    return(View(model));
                }

                UploadManager.UserProfileImageFolderCreate(res.Result.Id);

                SuccessfulOperationsViewModel successful_notifyobj = new SuccessfulOperationsViewModel()
                {
                    title          = "Your registration is successful.",
                    text           = "Please activate your account to sign in.",
                    RedirectingUrl = "/Home/SignIn"
                };
                successful_notifyobj.Items.Add("Please activate your account using the activation link we sent to you.");

                return(View("SuccessfulOperation", successful_notifyobj));
            }
            return(View(model));
        }
        public ActionResult TestNotify()
        {
            SuccessfulOperationsViewModel model1 = new SuccessfulOperationsViewModel()
            {
                Header = "INFORMATION",
                title  = "Operation Successful.",
                Items  = new List <string>()
                {
                    "Test basarili 1 ", "Test Basarili 2"
                },
                IsRedirecting = false
            };

            InformationOperationsViewModel model2 = new InformationOperationsViewModel()
            {
                Header = "INFORMATION",
                title  = "Operation Successful.",
                Items  = new List <string>()
                {
                    "Test basarili 1 ", "Test Basarili 2"
                },
                IsRedirecting = false
            };

            WarningOperationsViewModel model3 = new WarningOperationsViewModel()
            {
                Header = "INFORMATION",
                title  = "Operation Successful.",
                Items  = new List <string>()
                {
                    "Test basarili 1 ", "Test Basarili 2"
                },
                IsRedirecting = false
            };

            ErrorViewModel model4 = new ErrorViewModel()
            {
                Header = "INFORMATION",
                title  = "Operation Successful.",
                Items  = new List <ErrorMessageObject>()
                {
                    new ErrorMessageObject()
                    {
                        Message = "Test Hatasi Bildirimi 1"
                    },
                    new ErrorMessageObject()
                    {
                        Message = "Test Hatasi Bildirimi 2"
                    }
                },
                IsRedirecting = false
            };

            return(View("Error", model4));
        }
コード例 #5
0
ファイル: UserHomeController.cs プロジェクト: war-man/E-Trade
        public ActionResult Register(RegisterViewModel model)
        {
            ValidationResult result = ValidationTool.Validate(new RegisterViewModelValidator(), model);

            if (result.IsValid == false)
            {
                foreach (var error in result.Errors)
                {
                    ModelState.AddModelError(error.PropertyName, error.ErrorMessage);
                }

                return(View());
            }

            BusinessLayerResult <Member> res = mngr_member.RegisterUser(model);

            if (res.Errors.Count > 0)
            {
                res.Errors.ForEach(x => ModelState.AddModelError("", x.Message)); //Tüm Errors List inde Foreach ile dön herbiri için ilgili string i (x yani) ModelState in Error üne ekle.

                return(View(model));
            }

            MemberImageUploadManager.UserProfileImageFolderCreate(res.Result.Id);

            SuccessfulOperationsViewModel successful_notify = new SuccessfulOperationsViewModel()
            {
                Header             = "INFORMATION",
                title              = "Please Activate Your Account.",
                RedirectingUrl     = "Home/Index",
                RedirectingTimeout = 5000,
                Items              = new List <SuccessfulMessageObject>()
                {
                    new SuccessfulMessageObject()
                    {
                        Message = "Successful Operations One"
                    },
                    new SuccessfulMessageObject()
                    {
                        Message = "Successful Operations Two"
                    }
                },
                IsRedirecting = false
            };

            return(View("SuccessfulNotificationPage", successful_notify));
        }
コード例 #6
0
ファイル: UserHomeController.cs プロジェクト: war-man/E-Trade
        public ActionResult UserActivate(Guid id)
        {
            BusinessLayerResult <Member> res = mngr_member.ActivateUser(id);

            if (res.Errors.Count > 0)
            {
                ErrorOperationsViewModel error_notifyobj = new ErrorOperationsViewModel()
                {
                    title              = "Invalid Operation!",
                    text               = "Your process was rejected by the system!",
                    Items              = res.Errors,
                    RedirectingUrl     = "/Home/Index",
                    RedirectingTimeout = 5000
                };

                return(View("ErrorNotificationPage", error_notifyobj));
            }

            SuccessfulOperationsViewModel successful_notify = new SuccessfulOperationsViewModel()
            {
                Header             = "INFORMATION",
                title              = "Your Account has been activated.",
                RedirectingUrl     = "Home/Index",
                RedirectingTimeout = 5000,
                Items              = new List <SuccessfulMessageObject>()
                {
                    new SuccessfulMessageObject()
                    {
                        Message = "Successful Operations One"
                    },
                    new SuccessfulMessageObject()
                    {
                        Message = "Successful Operations Two"
                    }
                },
                IsRedirecting = false
            };

            return(View("SuccessfulNotificationPage", successful_notify));
        }