Admin.AdminCatalogResponse Admin.IAdminCatalogManager.SaveCatalog(Admin.WebStoreCatalog catalog) { try { // authenticate the user as a seller if (UtilityFactory.CreateUtility <ISecurityUtility>().SellerAuthenticated()) { // map to the accessor DTO DTO.WebStoreCatalog accCatalog = new DTO.WebStoreCatalog(); DTOMapper.Map(catalog, accCatalog); accCatalog = AccessorFactory.CreateAccessor <ICatalogAccessor>().SaveCatalog(accCatalog); if (accCatalog != null) { Admin.WebStoreCatalog result = new Admin.WebStoreCatalog(); DTOMapper.Map(accCatalog, result); return(new Admin.AdminCatalogResponse() { Success = true, Catalog = result }); } return(new Admin.AdminCatalogResponse() { Success = false, Message = "Catalog not saved" }); } return(new Admin.AdminCatalogResponse() { Success = false, Message = "Seller not authenticated" }); } catch (Exception ex) { Logger.Error(ex); return(new Admin.AdminCatalogResponse() { Success = false, Message = "There was a problem saving the catalog" }); } }
Admin.AdminCatalogResponse Admin.IAdminCatalogManager.ShowCatalog(int catalogId) { try { // authenticate the user as a seller if (UtilityFactory.CreateUtility <ISecurityUtility>().SellerAuthenticated()) { var catalog = AccessorFactory.CreateAccessor <ICatalogAccessor>() .Find(catalogId); if (catalog != null) { if (catalog.SellerId == Context.SellerId) { Admin.WebStoreCatalog result = new Admin.WebStoreCatalog(); DTOMapper.Map(catalog, result); return(new Admin.AdminCatalogResponse() { Success = true, Catalog = result }); } } return(new Admin.AdminCatalogResponse() { Success = false, Message = "Catalog not found" }); } return(new Admin.AdminCatalogResponse() { Success = false, Message = "Seller not authenticated" }); } catch (Exception ex) { Logger.Error(ex); return(new Admin.AdminCatalogResponse() { Success = false, Message = "There was a problem accessing the catalog" }); } }
Admin.AdminCatalogsResponse Admin.IAdminCatalogManager.FindCatalogs() { try { // authenticate the user as a seller if (UtilityFactory.CreateUtility <ISecurityUtility>().SellerAuthenticated()) { var catalogs = AccessorFactory.CreateAccessor <ICatalogAccessor>() .FindAllSellerCatalogs(); List <Admin.WebStoreCatalog> catalogList = new List <Admin.WebStoreCatalog>(); foreach (var catalog in catalogs) { Admin.WebStoreCatalog result = new Admin.WebStoreCatalog(); DTOMapper.Map(catalog, result); catalogList.Add(result); } return(new Admin.AdminCatalogsResponse() { Success = true, Catalogs = catalogList.ToArray() }); } return(new Admin.AdminCatalogsResponse() { Success = false, Message = "Seller not authenticated" }); } catch (Exception ex) { Logger.Error(ex); return(new Admin.AdminCatalogsResponse() { Success = false, Message = "There was a problem accessing this seller's catalogs" }); } }