예제 #1
0
        public IActionResult Error()
        {
            var exceptionDetails = HttpContext.Features.Get <IExceptionHandlerPathFeature>();

            var errorViewModel = ErrorViewModels.Create(exceptionDetails);

            return(View(errorViewModel));
        }
예제 #2
0
        public ActionResult EditProfile()
        {
            BusinessLayerResult <ND_User> res = userManager.GetUserById(CurrentSession.User.Id);

            if (res.Errors.Count > 0)
            {
                ErrorViewModels errorModel = new ErrorViewModels()
                {
                    Title = "Hata Oluştu",
                    Items = res.Errors
                };

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

            return(View(res.Result));
        }
예제 #3
0
        public ActionResult DeleteProfile()
        {
            BusinessLayerResult <ND_User> res = userManager.RemoveUserById(CurrentSession.User.Id);


            if (res.Errors.Count > 0)
            {
                ErrorViewModels errorNotifyObj = new ErrorViewModels()
                {
                    Items          = res.Errors,
                    Title          = "Profil Silinemedi.",
                    RedirectingUrl = "/Home/ShowProfile"
                };

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

            CurrentSession.Clear();

            return(RedirectToAction("Index"));
        }
예제 #4
0
        public ActionResult EditProfile(ND_User model, HttpPostedFileBase ProfileImage)
        {
            ModelState.Remove("ModifiedUsername");

            if (ModelState.IsValid)
            {
                if (ProfileImage != null &&
                    (ProfileImage.ContentType == "image/jpeg" ||
                     ProfileImage.ContentType == "image/jpg" ||
                     ProfileImage.ContentType == "image/png"))
                {
                    string filename = $"user_{model.Id}.{ProfileImage.ContentType.Split('/')[1]}";

                    ProfileImage.SaveAs(Server.MapPath($"~/images/{filename}"));
                    model.ProfileImageFilename = filename;
                }

                BusinessLayerResult <ND_User> res = userManager.UpdateProfile(model);

                if (res.Errors.Count > 0)
                {
                    ErrorViewModels errorNotifyObj = new ErrorViewModels()
                    {
                        Items          = res.Errors,
                        Title          = "Profil Güncellenemedi.",
                        RedirectingUrl = "/Home/EditProfile"
                    };

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

                // Profil güncellendiği için session güncellendi.
                CurrentSession.Set <ND_User>("login", res.Result);

                return(RedirectToAction("ShowProfile"));
            }

            return(View(model));
        }
예제 #5
0
        public ActionResult UserActivate(Guid id)
        {
            BusinessLayerResult <ND_User> res = userManager.ActivateUser(id);

            if (res.Errors.Count > 0)
            {
                ErrorViewModels errorModel = new ErrorViewModels()
                {
                    Items = res.Errors
                };
                //TempData["errors"] = res.Errors;
                return(View("Error", errorModel));
            }

            OkViewModel okModel = new OkViewModel()
            {
                Title          = "Kayıt Başarılı",
                RedirectingUrl = "/Home/Login"
            };

            okModel.Items.Add("Aktivasyon işleminiz başarı ile gerçekleştirildi. Artık not işlemlerini yapabilirsiniz.");

            return(View("Ok", okModel));
        }