protected void Page_Load(object sender, EventArgs e) { if (cbid != "") { cb = service.GetDetail(cbid); next = service.GetNextRecord(cb); prev = service.GetPrevRecord(cb); } }
public int ChangeState(CookBook item, int state) { using (var context = new WSI.DataAccess.WSICmsContext()) { context.CookBooks.Attach(item); item.State = state; context.LogChangesDuringSave = true; return context.SaveChanges(); } }
protected string GetNavigationName(CookBook cb) { var nav = navService.GetDetail(cb.NavigationId.ToString()); if (nav.ParentId != null) { var parent = navService.GetDetail(nav.ParentId.ToString()); if (parent != null) { return string.Format("{0}({1})", nav.NavName, parent.NavName); } } return nav.NavName; }
public CookBook GetPrevRecord(CookBook current) { using (var context = new WSI.DataAccess.WSICmsContext()) { return context.CookBooks .Where(c => c.NavigationId == current.NavigationId) .Where(c => c.CreateTime > current.CreateTime) .OrderByDescending(c => c.CreateTime) .FirstOrDefault(); } }