public string GetProduct(string id) { Models.Category p; string arr; using (var db = new Models.CartEntities()) { p = db.Categories.FirstOrDefault(e => e.catid.Equals(id)); arr = p.catid + "|" + p.name + "|" + p.desc; } if (p == null) return ""; else return arr; }
public string GetProduct(string id) { Models.Product p; string arr; using (var db = new Models.CartEntities()) { p = db.Products.FirstOrDefault(e => e.productid.Equals(id)); var tien = string.Format("{0:0}", p.price); arr = p.productid + "|" + p.catid + "|" + p.name + "|" + tien + "|" + p.size + "|" + p.image; } if (p == null) return ""; else return arr; }