Ejemplo n.º 1
0
        public ProductStatusItem GetByAscii(string ascii)
        {
            var key = string.Format("ProductStatusRepositoryGetByAscii{0}", ascii);

            var result = new ProductStatusItem();

            if (!this.TryGetCache<ProductStatusItem>(out result, key))
            {
                var query = from p in web365db.tblProductStatus
                            where p.NameAscii == ascii && p.IsShow == true && p.IsDeleted == false
                            orderby p.ID descending
                            select new ProductStatusItem()
                            {
                                ID = p.ID,
                                Name = p.Name,
                                NameAscii = p.NameAscii,
                                Number = p.Number
                            };

                result = query.FirstOrDefault();

                this.SetCache(key, result, 10);
            }

            return result;
        }
Ejemplo n.º 2
0
        public ActionResult EditForm(int? id)
        {
            var obj = new ProductStatusItem();

            var listProductType = productStatusRepository.GetListForTree<object>();

            if (id.HasValue)
                obj = productStatusRepository.GetItemById<ProductStatusItem>(id.Value);

            return Json(new
            {
                data = obj,
                listType = listProductType
            }, JsonRequestBehavior.AllowGet);
        }