/// <summary> /// Create a new ListingCategory object. /// </summary> /// <param name="listingCategoryId">Initial value of the ListingCategoryId property.</param> /// <param name="listingId">Initial value of the ListingId property.</param> /// <param name="categoryId">Initial value of the CategoryId property.</param> public static ListingCategory CreateListingCategory(global::System.Int64 listingCategoryId, global::System.Int64 listingId, global::System.Int32 categoryId) { ListingCategory listingCategory = new ListingCategory(); listingCategory.ListingCategoryId = listingCategoryId; listingCategory.ListingId = listingId; listingCategory.CategoryId = categoryId; return listingCategory; }
/// <summary> /// Deprecated Method for adding a new object to the ListingCategory EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToListingCategory(ListingCategory listingCategory) { base.AddObject("ListingCategory", listingCategory); }
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; }