public OperationResult<long> CreateListingCategory(ICategoryDTO categoryDto) { OperationResult<long> operationResult = null; try { var listingDAC = (IListingDAC)DACFactory.Instance.Create(DACType.Listing); var resultListing = listingDAC.CreateListingCategory(categoryDto); operationResult = resultListing != null ? OperationResult<long>.CreateSuccessResult(resultListing) : OperationResult<long>.CreateFailureResult( ResourceUtility.GetCaptionFor( ResourceConstants.Vendor.ErrorMessages.FailedToFetchListing)); } catch (DACException dacEx) { operationResult = OperationResult<long>.CreateErrorResult(dacEx.Message, dacEx.StackTrace);//todo } catch (Exception ex) { ExceptionManager.HandleException(ex); operationResult = OperationResult<long>.CreateErrorResult(ex.Message, ex.StackTrace);//todo } return operationResult; }
private ICategory ConvertCategory(ICategoryDTO categoryDTO) { return(new Category() { Id = categoryDTO.Id, Name = categoryDTO.Name }); }
public OperationResult<long> CreateListingCategory(ICategoryDTO categoryDto) { var listingBDC = (IListingBDC)BDCFactory.Instance.Create(BDCType.Listing); return listingBDC.CreateListingCategory(categoryDto); }
public long CreateListingCategory(ICategoryDTO categoryDto) { long retVal = GlobalConstants.DefaultCreateId; try { if (categoryDto != null) { using (TransactionScope trans = new TransactionScope()) { using (var TMCDbContext = new TMCContext()) { var listingCategory = new ListingCategory(); listingCategory.ListingId = categoryDto.ListingId; listingCategory.CategoryId = categoryDto.CategoryId; //todo check if already added and for service location also TMCDbContext.ListingCategory.AddObject(listingCategory); if (TMCDbContext.SaveChanges() > 0) { retVal = listingCategory.ListingCategoryId; } } trans.Complete(); } } } catch (Exception ex) { ExceptionManager.HandleException(ex); throw new DACException("Error while creating the listing detail.", ex); } return retVal; }