public string GetFooter(long shopid) { var model = DbFactory.Default.Get <ShopFooterInfo>().Where(p => p.ShopId == shopid).FirstOrDefault(); if (model == null) { model = new ShopFooterInfo(); model.ShopId = shopid; model.Footer = ""; DbFactory.Default.Add(model); } return(model == null ? "" : model.Footer); }
public string GetFooter(long shopid) { var model = Context.ShopFooterInfo.FirstOrDefault(p => p.ShopId == shopid); if (model == null) { ShopFooterInfo info = new ShopFooterInfo(); info.ShopId = shopid; info.Footer = ""; info = Context.ShopFooterInfo.Add(info); Context.SaveChanges(); //补充获取 model = Context.ShopFooterInfo.FirstOrDefault(p => p.ShopId == shopid); } return(model == null?"":model.Footer); }