public JsonResult LoginPost(string userName, string pass)
        {
            int flag = FlagStatus.ServerError;

            try
            {
                string     MD5Pass = Lib.Encrypt(pass);
                UserListBL uBL     = new UserListBL();
                //UserModel usermodel = new UserModel();
                if (userName != string.Empty && pass != string.Empty)
                {
                    var user = uBL.GetUserByUserPass(userName, MD5Pass);
                    if (user != null)//nếu tồn tại trong hệ thống thì get DB xem ở nhóm nào, quyền gì
                    {
                        var usermodel = uBL.GetPermission_ByUserName(userName);
                        FormsAuthentication.SetAuthCookie(JsonConvert.SerializeObject(usermodel, Formatting.None), false);
                        flag = FlagStatus.Success;
                    }
                    else
                    {
                        flag = FlagStatus.DataNotFound;
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorWriter.WriteLog(Server.MapPath("~"), "[LoginPost]", ex.ToString());
                return(Json(flag, JsonRequestBehavior.AllowGet));
            }
            return(Json(flag, JsonRequestBehavior.AllowGet));
        }
Example #2
0
        public ActionResult EditList(int id)
        {
            ListDetailViewModel model = new ListDetailViewModel();

            model.List   = UserListBL.GetListObject(id);
            model.Movies = UserListBL.GetAllViewByListID(id);

            return(View(model));
        }
Example #3
0
        public ActionResult CreateNewList(ListMainModel model)
        {
            model.UserList.UserID = UserID;

            UserListDO savedObject = UserListBL.SaveUserList(model.UserList);

            if (savedObject.ID > 0)
            {
                TempData["InfoMessage"] = "List created";
                return(RedirectToAction("ViewList", new { id = savedObject.ID }));
            }
            else
            {
                TempData["ErrorMessage"] = "Error occurred while creating list!";
            }

            return(View(model));
        }
Example #4
0
 public JsonResult AddToList(int ListID, int UserID, int MovieID)
 {
     UserListBL.SaveToList(ListID, MovieID, UserID);
     return(Json("ok"));
 }
Example #5
0
        public ActionResult Index( )
        {
            List <UserListDO> model = UserListBL.GetAllForUser(UserID);

            return(View(model));
        }