Exemplo n.º 1
0
        public JsonResult AddUpdatePageUser(LP_PageUser_Property objpageuser)
        {
            try
            {
                int userid = Convert.ToInt16(Session["UID"].ToString());
                List <LP_PageUser_Property> pageserlist = new List <LP_PageUser_Property>();

                //DBClass.db.Database.ExecuteSqlCommand("Delete from PageUsers where UserID={0}", timeline.UserID);
                //DBClass.db.SaveChanges();
                for (int i = 0; i < objpageuser.PageList.Count; i++)
                {
                    LP_PageUser_Property objpguser = new LP_PageUser_Property();
                    objpguser.UserID      = objpageuser.UserID;
                    objpguser.PageID      = objpageuser.PageList[i].ID;
                    objpguser.CreatedDate = DateTime.Now;
                    objpguser.status      = true;
                    objpguser.CreatedBy   = userid;
                    pageserlist.Add(objpguser);
                }
                objpageuser.DetailData = Helper.ToDataTable <LP_PageUser_Property>(pageserlist);
                objUserBll             = new User_BLL();
                bool flag = objUserBll.UpdatePageUser(objpageuser);


                return(Json(new { success = flag, statuscode = 200, url = "/Account/PageUser" }, JsonRequestBehavior.AllowGet));
            }

            catch (Exception ex)
            {
                return(Json(new { success = false }, JsonRequestBehavior.AllowGet));
            }
        }