public IHttpActionResult GetPagesByClient(string id, NewClientWebPagesDBEntities db) { CustomPageService customPageService = new CustomPageService(); // var content = webContentService.GetWebContentByPageId(id, db); var pages = customPageService.GetAllPagesByClientUrl(id, db); return(Ok(pages)); }
public List <CustomPage> GetAllPagesByClientUrl(string clientUrl, NewClientWebPagesDBEntities db) { //Write method to grab all pages from the db that are attached to the clientUrl List <CustomPage> pageByClientList = new List <CustomPage>(); foreach (var page in db.CustomPages) { if (page.ClientUrl == clientUrl) { pageByClientList.Add(page); } } return(pageByClientList.OrderByDescending(x => x.PageDescription == "Home").ThenBy(x => x.PageId).ToList()); }
public CustomPage UpsertSubPage(CustomPage customPage, NewClientWebPagesDBEntities db) { using (db) { if (customPage.PageId == default(int)) { db.CustomPages.Add(customPage); } else { db.Entry(customPage).State = EntityState.Modified; } db.SaveChanges(); return(customPage); } }
public List <CustomPage> GetSubNavLinks(NewClientWebPagesDBEntities db, int id) { List <CustomPage> subPagesByParentId = new List <CustomPage>(); using (db) { foreach (var page in db.CustomPages) { if (page.ParentId == id) { subPagesByParentId.Add(page); } } return(subPagesByParentId.ToList()); } }
public CustomPageService(NewClientWebPagesDBEntities context) { _context = context; }