Example #1
0
        public virtual ActionResult Register(RegisterModel model)
        {
            if (ModelState.IsValid)
            {
                try {
                    _context.CreateUser(model.Email, model.Slug, model.Password, model.DisplayName);
                    FormsAuthentication.SetAuthCookie(model.Email, false);

                    return(RedirectToAction(T4Routes.Photo.Index()));
                } catch (DbValidationException exception) {
                    Logger.Write(exception);
                    ModelState.AddModelError("", exception.Message);
                } catch (Exception exception) {
                    Logger.Write(exception);
                    ModelState.AddModelError("", "لطفا مجددا تلاش کنید!");
                }
            }

            return(View(Views.Register, model));
        }