public List <SingleProductViewModel> FindAllMatchingListings(FindProductInfoViewModel productView) { var domainModel = createModel.MappingListing(productView); var domainList = ListingHelper.GetAllListingsByProductName(domainModel); return(createModel.MappingAllViewListings(domainList)); }
public IActionResult Create(string businessType) { var model = getModelByBusinessType(businessType); model.Listing.Categories.AddRange(ListingHelper.GetCategories(model.Listing)); return(View(model)); }
public bool AddListingToDb(CreateNewListingViewModel listing) { var newItem = createModel.MappingDomainListing(listing); ListingHelper.AddListingById(newItem); return(true); }
public IActionResult RemoveListing(string listing) { int listingId = Int32.Parse(Regex.Match(listing, @"\d+").Value); ListingHelper.DeleteListingById(listingId); return(RedirectToAction("GetListing", "Home")); }
public IActionResult Create(BusinessViewModel model) { var listing = model.Listing; var categories = ListingHelper.GetCategories(listing); listing.Categories.AddRange(categories); businessRepo.Add(listing); return(RedirectToAction("CreateLocation", new { id = model.Listing.Id.ToString() })); }
public List <dm.Listing> ListofListing(CreateNewListingViewModel listing) { var listingitem = ListingHelper.GetallListingsByListingId(listing.ListingId); foreach (var item in listingitem) { createModel.MappingListing(item); } return(listingitem); }
public void Test_GetAllListingById() { User user = new User { UserId = 1, }; var sut = ListingHelper.GetAllListingById(user.UserId); Assert.NotEmpty(sut); }
// here is pending public bool AddListing(dm.Listing listing) { var checkShoeSize = validator.ValidateShoeSize(listing); if (checkShoeSize) { ListingHelper.AddListingById(listing); return(true); } return(false); }
public IActionResult SaveOrder() { var sessionusername = (int)HttpContext.Session.GetInt32("UserId"); var defaultAddress = AddressHelper.GetAddressByDefaultId(); var defaultPayment = PaymentHelper.GetPaymentByDefaultId(); var defaultUser = UserHelper.GetUserInfoById(sessionusername); dm.Orders user = new dm.Orders { User = defaultUser }; var getProduct = JsonConvert.DeserializeObject <List <OrderAndPaymentViewModel> >(HttpContext.Session.GetString("ProductTime")); List <dm.Orders> finalOrderModel = new List <dm.Orders>(); string guid = System.Guid.NewGuid().ToString(); foreach (var item in getProduct) { var model = new ConversionOrder(); finalOrderModel.Add(model.MappingOrders(item)); } foreach (var item in finalOrderModel) { var currentListing = ListingHelper.GetListingInfoByIdForOrder(item); item.OrderGroupNumber = guid; item.ShippingStatus = "Pending"; //item.Timestamp = GetTimestamp(DateTime.Now); item.User = defaultUser; item.Payment = defaultPayment; item.Payment.User = defaultUser; item.Listing = currentListing; item.Listing.User = defaultUser; item.Listing.ProductInfo = currentListing.ProductInfo; item.Listing.ProductInfo.Brand = currentListing.ProductInfo.Brand; item.Listing.ProductInfo.Type = currentListing.ProductInfo.Type; } foreach (var item in finalOrderModel) { var result = OrderHelper.AddOrderById(item); ListOfProducts.RemoveAll(p => p.ProductInfoId > 0); //if (result) //{ // ListingHelper.UpdateQuantityById(item.Listing); //} } return(RedirectToAction("Account", "Home")); }
public IActionResult GetListing() { List <dm.Listing> listings = ListingHelper.GetAllListingById((int)HttpContext.Session.GetInt32("UserId")); var model = new ConversionNewListing(); List <CreateNewListingViewModel> viewModel = model.MappingViewListings(listings); foreach (var item in viewModel) { var productInfo = ListingHelper.GetProductIdByListingId(item.ListingId); item.ProductTitle = productInfo.ProductTitle; item.ImageUrl = productInfo.ImageUrl; } return(View("~/Views/Partials/GetListings.cshtml", viewModel)); }
public IActionResult ProductInfoView(string viewItem) { int selectedProductId; if (viewItem == null) { selectedProductId = Int32.Parse(HttpContext.Session.GetString("ProductId")); } else { HttpContext.Session.SetString("ProductId", viewItem); selectedProductId = Int32.Parse(viewItem); } var convert = new ConversionListing(); List <dm.Listing> allListings = ListingHelper.GetAllListingsByProductInfoId(selectedProductId); dm.ProductInfo productInfo = FindProductInfoHelper.SingleProductById(selectedProductId); List <SingleProductViewModel> convertedList = convert.MappingAllViewListings(allListings); foreach (var item in convertedList) { item.Color = productInfo.Color; item.Description = productInfo.Description; item.ImageUrl = productInfo.ImageUrl; item.DisplayPrice = productInfo.DisplayPrice; item.ReleaseDate = productInfo.ReleaseDate; item.ProductTitle = productInfo.ProductTitle; } if (convertedList.Count == 0) { convertedList.Add(new SingleProductViewModel { Color = productInfo.Color, Description = productInfo.Description, ImageUrl = productInfo.ImageUrl, DisplayPrice = productInfo.DisplayPrice, ReleaseDate = productInfo.ReleaseDate, ProductTitle = productInfo.ProductTitle }); } return(View("~/Views/Store/SingleItem.cshtml", convertedList)); }
public override bool Logic(MongoClient client, IMongoDatabase db) { var businessCollection = db.GetCollection <BusinessListing>("businesses"); var businesses = businessCollection.AsQueryable().ToList(); foreach (var item in businesses) { var categories = ListingHelper.GetCategories(item); item.Categories.AddRange(categories); businessCollection.FindOneAndReplace <BusinessListing>(l => l.Id == item.Id, item); } var categoriesCollection = db.GetCollection <Category>("categories"); // Update shopkeepers to retail var shopKeepersCategory = categoriesCollection.AsQueryable().Single(c => c.Name == "Shopkeepers"); shopKeepersCategory.DisplayName = "Retail"; categoriesCollection.FindOneAndReplace <Category>(c => c.Id == shopKeepersCategory.Id, shopKeepersCategory); // Update Information to Support & Information var informationCategory = categoriesCollection.AsQueryable().Single(c => c.Name == "Information"); informationCategory.DisplayName = "Support & Information"; informationCategory.Description = "Do you offer support or information?"; categoriesCollection.FindOneAndReplace <Category>(c => c.Id == informationCategory.Id, informationCategory); var businessCategories = categoriesCollection.AsQueryable().ToList().Where(c => c.Type == ListingCategory.Business).OrderBy(c => c.DisplayName); int count = 1; foreach (var item in businessCategories) { if (item.Name == "Other") { item.DisplayOrder = 10; } else { item.DisplayOrder = 10 + count; count++; } categoriesCollection.FindOneAndReplace <Category>(c => c.Id == item.Id, item); } return(true); }
public void Test_GetListingInfoByIdForOrder() { Orders order = new Orders { OrderId = 43, Listing = new Listing { ListingId = 41, ProductInfo = new ProductInfo { ProductInfoId = 17, } } }; var sut = ListingHelper.GetListingInfoByIdForOrder(order); Assert.NotNull(sut); }
static void Main(string[] args) { //Just here for the purposes of alpha prototype stuff //UserService US = new UserService(); //User ushi = US.GetUser(client, "ushi84", true, false); const string consumerKey = ""; const string consumerSecret = ""; const string accessToken = ""; const string accessTokenSecret = ""; var client = new RestClient(); client.BaseUrl = AppKeys.GetBaseUri(); client.Authenticator = OAuth1Authenticator.ForProtectedResource(consumerKey, consumerSecret, accessToken, accessTokenSecret); ShopService SS = new ShopService(); ListingService LS = new ListingService(); UserService US = new UserService(); var Company = InternalClientService.GetInternalClientByID("646"); bool consoleApp = false; if (consoleApp) { //RestRequest request = new RestRequest("/oauth/scopes", Method.GET); //IRestResponse response = client.Execute(request); //JObject oq = JObject.Parse(response.Content); //Console.WriteLine(oq.ToString()); var command = Console.ReadLine(); var user = US.GetUser(client, "threadedtees", true, false); if (command.ToLower() == "getlistings") { RestRequest request = new RestRequest(); request.Resource = string.Format("/taxonomy/seller/get"); IRestResponse response = client.Execute(request); JObject o = JObject.Parse(response.Content); Console.WriteLine(o.ToString()); LS.ImportListing(client); Authorization.GetAccessToken(); var listings = SS.GetShopListings(client, Company.EtsyShopIDs.First()); //listring id //title //variation name //variation value ExportHelpers.ExportListingIdAndVariations(user.shops.FirstOrDefault().listings, @"C:\Internal\Etsy\ListingIdAndVariation.txt", true); } if (command.ToLower() == "createlistings") { ListingHelper.CreateEtsyListingFromCustomMapping(client, Company, @"C:\Internal\Etsy\CalculatedFailure_FirstTest_Amazon_Feed.txt"); } #region Listing Tool Code #endregion if (command.ToLower() == "download") { string path = @"C:\Internal\Etsy.txt"; var receipts = SS.GetOpenShopReceipts(client, Company.EtsyShopIDs.FirstOrDefault()); Console.WriteLine("Exporting..."); ExportHelpers.ExtractionExport(receipts, path, CountryService.GetCountryMapping(client), true); Console.Write("Export Complete"); } if (command.ToLower() == "upload") { ImportHelpers.ShippingSummaries(); Console.Write("Upload Complete"); Console.ReadLine(); } } else { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new DownloadUploadForm()); } #region Listing Creation Stuff #endregion }
public void Test_GetAllListinbByProductName() { var sut = ListingHelper.GetProductIdByListingId(listing2.ListingId); Assert.NotNull(sut); }
public void Test_GetAllListingByListingId() { var sut = ListingHelper.GetallListingsByListingId(listing2.ListingId); Assert.NotEmpty(sut); }
public void Test_GetAllListingByProductInfoId() { var sut = ListingHelper.GetAllListingsByProductInfoId(listing2.ProductInfo.ProductInfoId); Assert.NotEmpty(sut); }
public SingleListingController(CCLdbContext context) { this.context = context; listingHelper = new ListingHelper(context); }