public async Task <SiteList> UpdateList(SiteList list) { var existingList = await GetListById(list.SiteListId, true); if (existingList == null) { throw new CallerException("Cannot find SiteList to update"); } existingList.Name = list.Name; existingList.Visible = list.Visible; existingList.UpdatedBy = list.UpdatedBy; using (var uow = new UnitOfWork(Context)) { var repo = new SiteListRepository(uow); existingList = await repo.Update(existingList); } var siteListCache = new SiteListCache(Cache); await siteListCache.InvalidateSiteListCache(); return(existingList); }
public async Task Delete(int listId) { using (var uow = new UnitOfWork(Context)) { var repo = new SiteListRepository(uow); await repo.Delete(listId); } var siteListCache = new SiteListCache(Cache); await siteListCache.InvalidateSiteListCache(); }
public async Task <SiteList> CreateSiteList(SiteList list) { var existingList = await GetLists(true, list.Name); if (existingList != null && existingList.Count > 0) { throw new CallerException("List name already exists"); } SiteList createdList; using (var uow = new UnitOfWork(Context)) { var repo = new SiteListRepository(uow); createdList = await repo.Create(list); } var siteListCache = new SiteListCache(Cache); await siteListCache.InvalidateSiteListCache(); return(createdList); }