Example #1
0
        public JsonResult Restore(int?id)
        {
            var dao = new CategoriesDAO();

            if (dao.ChangeBin(id))
            {
                List <Category>    categories = db.Categories.Where(n => n.category_bin == true).OrderByDescending(n => n.category_datecreate).ToList();
                List <jCategories> list       = categories.Select(n => new jCategories
                {
                    category_active     = n.category_active,
                    category_bin        = n.category_bin,
                    category_datecreate = n.category_datecreate.Value.ToString("dd/MM/yyyy"),
                    category_dateupdate = n.category_dateupdate.Value.ToString("dd/MM/yyyy"),
                    category_id         = n.category_id,
                    category_img        = n.category_img,
                    category_name       = n.category_name,
                    category_note       = n.category_note,
                    category_view       = n.category_view,
                }).ToList();
                return(Json(list, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(null));
            }
        }