Exemplo n.º 1
0
        public JsonResult Option(int?id)
        {
            var dao = new CategoriesDAO();

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