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); }
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)); }