public static void Create(User model, out string redirectUrl) { redirectUrl = string.Empty; //Set authorization cookie FormsAuthentication.SetAuthCookie(TextHelper.ToString(model.UserId), false); var returnUrl = QueryHelper.GetQueryString("ReturnUrl"); //Create Cookie if (!UserCookie.Create(model)) return; redirectUrl = returnUrl; if (string.IsNullOrEmpty(redirectUrl)) { switch (model.UserRoleId) { //Administrator case 1: redirectUrl = "~/Admin/"; break; default: redirectUrl = "~/"; break; } } }
public static bool Create(User model) { //Create Cookie var cookie = new HttpCookie(CookieName); //Assign Cookie cookie["id"] = TextHelper.ToString(model.UserId); cookie["name"] = model.Name; cookie["roleId"] = TextHelper.ToString(model.UserRoleId); cookie.Expires = DateTime.Now.AddDays(30); //Add Cookie HttpContext.Current.Response.Cookies.Add(cookie); return IsCookieExist(); }
partial void DeleteUser(User instance);
partial void UpdateUser(User instance);
partial void InsertUser(User instance);
private void detach_Users(User entity) { this.SendPropertyChanging(); entity.UserRole = null; }
private void attach_Users(User entity) { this.SendPropertyChanging(); entity.UserRole = this; }