public async Task <DbResponse <ProductCatalogTypeViewModel> > AddCustomAsync(ProductCatalogTypeViewModel model) { var response = new DbResponse <ProductCatalogTypeViewModel>(); if (await Context.ProductCatalogType.AnyAsync(c => c.CatalogType == model.CatalogType).ConfigureAwait(false)) { response.Message = "This category type already exist"; response.IsSuccess = false; return(response); } var catalogType = new ProductCatalogType { CatalogType = model.CatalogType }; await Context.ProductCatalogType.AddAsync(catalogType).ConfigureAwait(false); try { await Context.SaveChangesAsync().ConfigureAwait(false); model.CatalogTypeId = catalogType.CatalogTypeId; response.IsSuccess = true; response.Message = "Success"; response.Data = model; return(response); } catch (DbUpdateException e) { response.Message = e.Message; response.IsSuccess = false; return(response); } }
public Task UpdateCustomAsync(ProductCatalogTypeViewModel model) { throw new System.NotImplementedException(); }