/// <summary> /// Create a new Listing object. /// </summary> /// <param name="listingId">Initial value of the ListingId property.</param> /// <param name="userId">Initial value of the UserId property.</param> /// <param name="businessName">Initial value of the BusinessName property.</param> /// <param name="businessDays">Initial value of the BusinessDays property.</param> /// <param name="businessHours">Initial value of the BusinessHours property.</param> /// <param name="cityId">Initial value of the CityId property.</param> /// <param name="address">Initial value of the Address property.</param> /// <param name="pinCode">Initial value of the PinCode property.</param> /// <param name="createdOn">Initial value of the CreatedOn property.</param> /// <param name="updatedOn">Initial value of the UpdatedOn property.</param> /// <param name="createdBy">Initial value of the CreatedBy property.</param> /// <param name="updatedBy">Initial value of the UpdatedBy property.</param> /// <param name="isActive">Initial value of the IsActive property.</param> /// <param name="isDeleted">Initial value of the IsDeleted property.</param> public static Listing CreateListing(global::System.Int64 listingId, global::System.Int64 userId, global::System.String businessName, global::System.Int16 businessDays, global::System.Int16 businessHours, global::System.Int32 cityId, global::System.String address, global::System.Int32 pinCode, global::System.DateTime createdOn, global::System.DateTime updatedOn, global::System.Int64 createdBy, global::System.Int64 updatedBy, global::System.Boolean isActive, global::System.Boolean isDeleted) { Listing listing = new Listing(); listing.ListingId = listingId; listing.UserId = userId; listing.BusinessName = businessName; listing.BusinessDays = businessDays; listing.BusinessHours = businessHours; listing.CityId = cityId; listing.Address = address; listing.PinCode = pinCode; listing.CreatedOn = createdOn; listing.UpdatedOn = updatedOn; listing.CreatedBy = createdBy; listing.UpdatedBy = updatedBy; listing.IsActive = isActive; listing.IsDeleted = isDeleted; return listing; }
/// <summary> /// Deprecated Method for adding a new object to the Listing EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToListing(Listing listing) { base.AddObject("Listing", listing); }
/// <summary> /// /// </summary> /// <param name="listingDto"></param> /// <returns></returns> public IListingDTO CreateListing(IListingDTO listingDto) { try { if (listingDto != null) { using (TransactionScope trans = new TransactionScope()) { using (var TMCDbContext = new TMCContext()) { var listing = new Listing(); EntityConverter.FillEntityFromDTO(listingDto, listing); listing.CreatedOn = DateTime.Now; listing.CreatedBy = 11; listing.UpdatedOn = DateTime.Now; listing.UpdatedBy = 11; listing.IsActive = true; listing.IsDeleted = false; listing.Address = "Default Address"; listing.PinCode = 12345; listing.UserId = 3; listing.CityId = 111; TMCDbContext.Listing.AddObject(listing); if (TMCDbContext.SaveChanges() > 0) { listingDto.ListingId = listing.ListingId; } } trans.Complete(); } } } catch (Exception ex) { ExceptionManager.HandleException(ex); throw new DACException("Error while creating the listing detail.", ex); } return listingDto; }