Ejemplo n.º 1
0
        public ActionResult CreateProduct(ProductModelView product)
        {
            ProductServiceHelper psh = new ProductServiceHelper();

            Product pd = new Product();

            pd.ProdCatId       = product.ProdCatId;
            pd.ProdDescription = product.ProdDescription;
            pd.ProdName        = product.ProdName;
            pd.ProductCategory = product.ProductCategory;

            pd.ProductAttributes = new List <ProductAttribute>();
            for (int i = 0; i < product.AttributeValue.Count; i++)
            {
                pd.ProductAttributes.Add(new ProductAttribute
                {
                    AttributeId    = product.AttributeKey[i],
                    AttributeValue = product.AttributeValue[i],
                    ProductId      = product.ProductId,
                });
            }

            psh.CreateProduct(pd);

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
        public ActionResult ProductDetail(int?id)
        {
            ProductModelView model = new ProductModelView();

            Product product = db.Products.SingleOrDefault(x => x.ProductId == id);

            model.Id                   = product.ProductId;
            model.Name                 = product.Name;
            model.Description          = product.Description;
            model.ImportPrice          = product.ImportPrice;
            model.Price                = product.Price;
            model.Status               = product.Status;
            model.MainPhoto1           = product.MainPhoto1;
            model.MainPhoto2           = product.MainPhoto2;
            model.MainPhoto3           = product.MainPhoto3;
            model.SecondaryPhoto1      = product.SecondaryPhoto1;
            model.SecondaryPhoto2      = product.SecondaryPhoto2;
            model.SecondaryPhoto3      = product.SecondaryPhoto3;
            model.Color                = product.Color;
            model.Amount               = product.Amount;
            model.Point                = product.Point;
            model.ProductGroupId       = product.ProductGroupId;
            model.ProductGroupName     = product.ProductGroup.Name;
            model.GuaranteeProductId   = product.GuaranteeProductId;
            model.GuaranteeProductTime = product.GuaranteeProduct.Time;
            model.PromotionId          = product.PromotionId;
            model.PromotionName        = product.Promotion.Name;
            model.PromotionSaleOff     = product.Promotion.SaleOff;
            model.ManufacturerId       = product.ManufacturerId;
            model.ManufacturerName     = product.Manufacturer.Name;

            return(View(model));
        }
Ejemplo n.º 3
0
        //public PartialViewResult CandidateEntries(string SessionIdentifier, string AssessmentIdentifier, int AssessmentVersion, string ComponentIdentifier, int ComponentVersion)
        //{
        //    //AssessmentIdentifier = SubjectCode
        //    //ComponentIdentifier = Subject Name + Paper number
        //    using (var db = new RM_GDEContext())
        //    {
        //        var centers = db.Candidates.Where(c => c.SubjectCode == AssessmentIdentifier);

        //        foreach (var center in centers)
        //        {
        //            int i = 0;
        //            using (SessionCompositionWS.SessionCompositionWS sessionComposition = new SessionCompositionWS.SessionCompositionWS())
        //            {
        //                Packet[] packets = new Packet[centers.Where(c => c.MsNo == center.MsNo).Count()];

        //                Packet packet = new Packet
        //                {
        //                    PacketBarcode = center.MsNo
        //                };

        //                packets[i] = packet;

        //                i++;

        //                PacketArguments packetArguments = new PacketArguments
        //                {
        //                    BusinessStreamIdentifier = WebServiceDetails.BusinessStreamIndentifier,
        //                    SessionIdentifier = SessionIdentifier,
        //                    AssessmentIdentifier = AssessmentIdentifier,
        //                    AssessmentVersion = AssessmentVersion,
        //                    ComponentIdentifier = ComponentIdentifier,
        //                    ComponentVersion = ComponentVersion,
        //                    CentreIdentifier = center.CentreName,
        //                    Packets = packets
        //                };

        //                var sendPackets = sessionComposition.Packets(WebServiceDetails.RMKey, packetArguments);
        //            }

        //        }

        //    }


        //    return PartialView();
        //}


        public ActionResult StartFeeds()
        {
            using (var db = new RM_GDEContext())
            {
                var session = db.Session.ToList();
                var product = db.Product.ToList();

                var questionPaperList = db.Candidates.Select(c => new QuestionPaperList {
                    value = c.SubjectCode, text = c.SubjectCode
                }).Distinct().ToList();

                var convertedList = new QuestionPaperList()
                {
                    value = null,
                    text  = "--- Select Qestion paper ---"
                };
                questionPaperList.Insert(0, convertedList);

                var enumerable     = new[] { convertedList };
                var sessionProduct = new ProductModelView()
                {
                    session        = session,
                    product        = product,
                    QuestionsPaper = questionPaperList
                };

                return(View(sessionProduct));
            }
        }
Ejemplo n.º 4
0
        public ActionResult UpdateProduct(ProductModelView product)
        {
            try
            {
                ProductServiceHelper psh = new ProductServiceHelper();
                Product prod             = new Product();

                prod.ProdCatId         = product.ProdCatId;
                prod.ProductId         = product.ProductId;
                prod.ProdDescription   = product.ProdDescription;
                prod.ProdName          = product.ProdName;
                prod.ProductCategory   = product.ProductCategory;
                prod.ProductAttributes = new List <ProductAttribute>();
                for (int i = 0; i < product.AttributeValue.Count; i++)
                {
                    prod.ProductAttributes.Add(new ProductAttribute
                    {
                        AttributeId    = product.AttributeKey[i],
                        AttributeValue = product.AttributeValue[i],
                        ProductId      = product.ProductId,
                    });
                }
                psh.UpdateProfile(prod);

                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                //log here
                return(View());
            }
        }
Ejemplo n.º 5
0
        public ActionResult SearchProduct(ProductModelView productModelView)
        {
            var products = _productManager.GetAll();

            if (!string.IsNullOrEmpty(productModelView.Code))
            {
                products = products.Where(p =>
                                          p.Code.ToLower().Contains(productModelView.Code.ToLower()) ||
                                          p.Name.ToLower().Contains(productModelView.Code.ToLower()) || p.Description.ToLower().Contains(productModelView.Code.ToLower()) || p.ReorderLevel.ToString().Contains(productModelView.Code.ToString()) || (_categoryManager.GetById(p.CategoryId).Name).ToLower().Contains(productModelView.Code.ToLower())).ToList();
                //products = products.Where(p =>
                //    p.Name.ToLower().Contains(productModelView.Code.ToLower())).ToList();
                //products = products.Where(p => p.CategoryId.ToString().Contains(productModelView.Code)).ToList();
                //products = products.Where(p =>
                //    p.Description.ToLower().Contains(productModelView.Code.ToLower())).ToList();
                //products = products.Where(p =>
                //    p.ReorderLevel.ToString().Contains(productModelView.Code.ToString())).ToList();
            }

            productModelView.Products = products;
            productModelView.CategorySelectListItems = _categoryManager.GetAll()
                                                       .Select(c => new SelectListItem()
            {
                Value = c.Id.ToString(),
                Text  = c.Name
            }).ToList();
            return(View(productModelView));
        }
        public void SaveModel(ProductModelView productModelView)
        {
            ProductModel productModel = productModelView.Id.HasValue ? GetModel(productModelView.Id.Value) : new ProductModel();

            UpdateProductModel(productModel, productModelView);
            productRepository.SaveModel(productModel);
        }
        // PUT api/products/id
        public IHttpActionResult PutProduct(int id, [FromBody] ProductModelView product)
        {
            var prodOld = productService.GetById(id);

            if (prodOld == null)
            {
                return(NotFound());
            }

            if (product == null)
            {
                return(BadRequest());
            }

            var newProd = new ProductDTO
            {
                Id          = id,
                ProductName = product.ProductName,
                CategoryId  = product.CategoryId,
                SupplierId  = product.SupplierId
            };

            productService.Update(newProd);

            return(Ok(new { Message = $"A product {product.ProductName} has updated" }));
        }
 private void UpdateProductModel(ProductModel productModel, ProductModelView productModelView)
 {
     productModel.Id           = productModelView.Id;
     productModel.Description  = productModelView.Description;
     productModel.ModelNumber  = productModelView.ModelNumber;
     productModel.Title        = productModelView.Title;
     productModel.Manufacturer = manufacturerRepository.GetManufacturer(productModelView.ManufacturerId.Value);
 }
Ejemplo n.º 9
0
        public void Atualizar(int id, ProductModelView productModelView)
        {
            var productDao = new ProductDao();
            var product    = productDao.ObeterPorId(id);

            var productAt = AtualizarProduct(productModelView, product);

            productAt.IdProduct = id;
            productDao.Atualizar(productAt);
        }
Ejemplo n.º 10
0
        public void Inserir(ProductModelView productModelView)
        {
            var product = new Product();

            product = PreparaProduct(productModelView, product);

            var productDao = new ProductDao();

            productDao.Inserir(product);
        }
Ejemplo n.º 11
0
        public void SupplyProduct(SupplyProductModelView supplyProduct)
        {
            UserManagement    userManagement    = new UserManagement();
            ProductManagement productManagement = new ProductManagement();
            string            token             = userManagement.GetToken();
            ProductModelView  product           = productManagement.GetProductDetails(supplyProduct.ProductId, token);

            product.UnitsInStock = (int.Parse(product.UnitsInStock) + supplyProduct.Quantity).ToString();
            productManagement.UpdateProduct(product, token);
        }
        public ActionResult Edit(ProductModelView productModelView)
        {
            if (!ModelState.IsValid)
            {
                ViewBag.ManufacturerId = new SelectList(manufacturerHelper.GetManufacturers(), "Id", "Tittle", productModelView.ManufacturerId);
                return(View(productModelView));
            }

            productHelper.SaveModel(productModelView);
            return(RedirectToAction("Index", "Product"));
        }
        /// <summary>
        /// Converts Product object to ProductViewModel
        /// </summary>
        /// <param name="product"></param>
        /// <returns></returns>
        public ProductModelView convertToProductModelView(Product product)
        {
            ProductModelView productModelView = new ProductModelView()
            {
                ProductName = product.ProductName,
                Price       = product.Price,
                Description = product.Description,
                JpgString   = ConvertByteArrayToString(product.ByteArrayImage)
            };

            return(productModelView);
        }
Ejemplo n.º 14
0
 public IActionResult Put(int id, [FromBody]  ProductModelView productModelView)
 {
     try
     {
         var productBll = new ProductBll();
         productBll.Atualizar(id, productModelView);
         return(StatusCode(204, new { ProductBll = productBll })); //Indica que o recurso foi alterado com sucesso
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         return(StatusCode(422, new { Erro = ex.Message })); //Exceções de negócio
     }
 }
Ejemplo n.º 15
0
 public IActionResult Post([FromBody] ProductModelView productModelView)
 {
     try
     {
         var productBll = new ProductBll();
         productBll.Inserir(productModelView);
         return(StatusCode(201, new { ProductBll = productBll })); //Postado com sucesso
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         return(StatusCode(422, new { Erro = ex.Message })); //Exceções de negócio
     }
 }
Ejemplo n.º 16
0
        public ActionResult SearchProduct()
        {
            ProductModelView productModelView = new ProductModelView()
            {
                Products = _productManager.GetAll(),
                CategorySelectListItems = _categoryManager.GetAll()
                                          .Select(c => new SelectListItem()
                {
                    Value = c.Id.ToString(),
                    Text  = c.Name
                }).ToList()
            };

            return(View(productModelView));
        }
Ejemplo n.º 17
0
        public ActionResult EditProduct(int Id)
        {
            Product product = _productManager.GetById(Id);

            ProductModelView productModelView = Mapper.Map <ProductModelView>(product);

            productModelView.CategorySelectListItems = _categoryManager.GetAll()
                                                       .Select(c => new SelectListItem()
            {
                Value = c.Id.ToString(),
                Text  = c.Name
            }).ToList();
            productModelView.Products = _productManager.GetAll();

            return(View(productModelView));
        }
        // POST api/products/id
        public IHttpActionResult PostProduct([FromBody] ProductModelView product)
        {
            if (!ModelState.IsValid || product == null)
            {
                return(BadRequest());
            }

            var model = new ProductDTO
            {
                ProductName = product.ProductName,
                SupplierId  = product.SupplierId,
                CategoryId  = product.CategoryId
            };

            productService.Create(model);

            return(Ok(new { Message = $"The new product {product.ProductName} has created" }));
        }
Ejemplo n.º 19
0
        public ProductModelView GetProductDetails(int productId, string token)
        {
            var client  = new RestClient("https://northwind-products-api-ss.appspot.com/");
            var request = new RestRequest("product/" + productId.ToString(), Method.GET);

            request.AddHeader("Accept", "application/json");
            request.AddHeader("token", token);

            request.Parameters.Clear();
            request.AddParameter("token", token, ParameterType.HttpHeader);

            var response = client.Execute(request);

            ProductModelView value = JsonConvert.DeserializeObject <ProductModelView>(response.Content);

            Console.WriteLine(value);
            return(value);
        }
Ejemplo n.º 20
0
        public ActionResult EditProduct(ProductModelView productModelView)
        {
            Product product = Mapper.Map <Product>(productModelView);

            if (ModelState.IsValid)
            {
                _productManager.Update(product);
            }

            productModelView.Products = _productManager.GetAll();
            productModelView.CategorySelectListItems = _categoryManager.GetAll()
                                                       .Select(c => new SelectListItem()
            {
                Value = c.Id.ToString(),
                Text  = c.Name
            }).ToList();

            return(View(productModelView));
        }
        public ActionResult Edit(long?id)
        {
            ProductModelView productModelView;

            if (id.HasValue)
            {
                productModelView = productHelper.GetProductModel(id.Value);

                if (productModelView == null)
                {
                    return(View("Error"));
                }
            }
            else
            {
                productModelView = new ProductModelView();
            }

            ViewBag.ManufacturerId = new SelectList(manufacturerHelper.GetManufacturers(), "Id", "Tittle", productModelView.ManufacturerId);
            return(View(productModelView));
        }
Ejemplo n.º 22
0
        public async Task Get_ProductSingleWithoutResult_NotFound()
        {
            var productDto = UtilityTest.GenerateProductDtoInDifferenttegoryAsync().First();

            var modelView = new ProductModelView
            {
                ProductId    = productDto.ProductId,
                CategoryId   = productDto.CategoryId,
                Name         = productDto.Name,
                CategoryName = "CategoryName",
                Description  = "Desc",
                Note         = "Note",
                Options      = new Dictionary <int, string> {
                    { 1, "Bianco" }
                }
            };

            var _mediatorMock = new Mock <IMediatorService>();

            _mediatorMock.Setup(x => x.Send(It.IsAny <GetProductByIdQuery>(),
                                            It.IsAny <CancellationToken>()))
            .ReturnsAsync((ProductModelView)null);

            var _loggerMock = new Mock <ILogger <ProductsController> >();

            var _mockMapper = new Mock <IMapper>();



            var productsController = new ProductsController(_loggerMock.Object, _mediatorMock.Object, _mockMapper.Object);
            var actionResult       = await productsController.GetProduct(100);



            var viewResult = Assert.IsType <Microsoft.AspNetCore.Mvc.NotFoundObjectResult>(actionResult);

            Assert.IsAssignableFrom <string>(viewResult.Value);
            Assert.Equal("Product id 100 not found", viewResult.Value);
        }
Ejemplo n.º 23
0
        public string UpdateProduct(ProductModelView product, string token)
        {
            var client  = new RestClient("https://northwind-products-api-ss.appspot.com/");
            var request = new RestRequest("updatepro/" + product.ProductID.ToString(), Method.PUT);

            UpdateProductModelView updateProduct = new UpdateProductModelView(product);
            var output = JsonConvert.SerializeObject(updateProduct);

            request.AddHeader("Accept", "application/json");
            request.AddHeader("token", token);

            request.Parameters.Clear();
            request.AddParameter("token", token, ParameterType.HttpHeader);
            request.AddJsonBody(output);

            var response = client.Execute(request);

            string value = JsonConvert.DeserializeObject <string>(response.Content);

            Console.WriteLine(value);
            return(value);
        }
Ejemplo n.º 24
0
        private async void PreencherDataGridViewProdutosAsync()
        {
            List <Product> products = await productRepository.GetAll();

            List <ProductModelView> productModelViews = new List <ProductModelView>();

            foreach (var product in products)
            {
                ProductModelView vm = new ProductModelView
                {
                    Id           = product.Id,
                    IdBrand      = product.IdBrand,
                    Name         = product.Name,
                    ProductBrand = product.ProductBrand.Name
                };
                productModelViews.Add(vm);
            }
            dvgProdutos.Invoke((MethodInvoker) delegate
            {
                dvgProdutos.DataSource = productModelViews;
                dvgProdutos.Refresh();
            });
        }
Ejemplo n.º 25
0
        public ActionResult AddProduct(ProductModelView productModelView)
        {
            Product product = Mapper.Map <Product>(productModelView);

            if (ModelState.IsValid)
            {
                ViewBag.Message = _productManager.Add(product) ? "Saved" : "Not Saved";
            }
            else
            {
                ViewBag.Message = "Model State Error";
            }

            productModelView.CategorySelectListItems = _categoryManager.GetAll()
                                                       .Select(c => new SelectListItem()
            {
                Value = c.Id.ToString(),
                Text  = c.Name
            }).ToList();

            productModelView.Products = _productManager.GetAll();
            return(View(productModelView));
        }
Ejemplo n.º 26
0
        public async Task <ActionResult> UpdateProduct(long id)
        {
            await FillCategories();

            ProductServiceHelper psh = new ProductServiceHelper();
            Product prod             = await psh.GetProductById(id);

            ProductModelView pvm = new ProductModelView();

            pvm.ProductId         = prod.ProductId;
            pvm.ProdCatId         = prod.ProdCatId;
            pvm.ProdDescription   = prod.ProdDescription;
            pvm.ProdName          = prod.ProdName;
            pvm.AttributeValue    = new List <string>();
            pvm.AttributeKey      = new List <int>();
            pvm.ProductAttributes = prod.ProductAttributes;
            foreach (var item in prod.ProductAttributes)
            {
                pvm.AttributeValue.Add(item.AttributeValue);
                pvm.AttributeKey.Add(item.AttributeId);
            }
            return(View(pvm));
        }
Ejemplo n.º 27
0
 public ActionResult CreateProduct(ProductModelView model)
 {
     try
     {
         List <Product> list = db.Products.ToList();
         if (model.Id > 0)
         {
             //update
             Product product = db.Products.SingleOrDefault(x => x.ProductId == model.Id);
             product.ProductId             = model.Id;
             product.Name                  = model.Name;
             product.Description           = model.Description;
             product.ImportPrice           = model.ImportPrice;
             product.Price                 = model.Price;
             product.Status                = model.Status;
             product.MainPhoto1            = model.MainPhoto1;
             product.MainPhoto2            = model.MainPhoto2;
             product.MainPhoto3            = model.MainPhoto3;
             product.SecondaryPhoto1       = model.SecondaryPhoto1;
             product.SecondaryPhoto2       = model.SecondaryPhoto2;
             product.SecondaryPhoto3       = model.SecondaryPhoto3;
             product.Color                 = model.Color;
             product.Amount                = model.Amount;
             product.Point                 = model.Point;
             product.ProductGroupId        = model.ProductGroupId;
             product.ProductGroup.Name     = model.ProductGroupName;
             product.GuaranteeProductId    = model.GuaranteeProductId;
             product.GuaranteeProduct.Time = model.GuaranteeProductTime;
             product.PromotionId           = model.PromotionId;
             product.Promotion.Name        = model.PromotionName;
             product.Promotion.SaleOff     = model.PromotionSaleOff;
             product.ManufacturerId        = model.ManufacturerId;
             product.Manufacturer.Name     = model.ManufacturerName;
             db.SaveChanges();
         }
         else
         {
             //Insert
             Product product = new Product
             {
                 Name               = model.Name,
                 Description        = model.Description,
                 ImportPrice        = model.ImportPrice,
                 Price              = model.Price,
                 Status             = model.Status,
                 MainPhoto1         = model.MainPhoto1,
                 MainPhoto2         = model.MainPhoto2,
                 MainPhoto3         = model.MainPhoto3,
                 SecondaryPhoto1    = model.SecondaryPhoto1,
                 SecondaryPhoto2    = model.SecondaryPhoto2,
                 SecondaryPhoto3    = model.SecondaryPhoto3,
                 Color              = model.Color,
                 Amount             = model.Amount,
                 Point              = model.Point,
                 ProductGroupId     = model.ProductGroupId,
                 GuaranteeProductId = model.GuaranteeProductId,
                 PromotionId        = model.PromotionId,
                 ManufacturerId     = model.ManufacturerId
             };
             db.Products.Add(product);
             db.SaveChanges();
         }
         return(View(model));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 28
0
        public Product PreparaProduct(ProductModelView productModelView, Product product)
        {
            var        product1   = new Product();
            ProductDao productDao = new ProductDao();

            var productExistente = productDao.ObeterPorCodigo(productModelView.CodigoBarra);

            if (productExistente != null)
            {
                throw new Exception("O PRODUTO já existe");
            }
            if (productModelView.CodigoBarra.Trim().Length == 0)
            {
                throw new Exception("Informe um CÓDIGO de barra do produto.");
            }
            else if (productModelView.Nome.Trim().Length == 0)
            {
                throw new Exception("Informe o NOME do produto.");
            }
            else if (productModelView.Estoque <= 0)
            {
                throw new Exception("Informe a QUANTIDADE do produto.");
            }
            else if (productModelView.Lote.Trim().Length == 0)
            {
                throw new Exception("Informe o LOTE do produto.");
            }
            else if (productModelView.DataValidade == null)
            {
                throw new Exception("Informe a DATA DE VALIDADE do produto.");
            }
            else if (productModelView.DataCadastro == null)
            {
                throw new Exception("Informe a DATA DE CADASTRO do produto.");
            }
            else if (productModelView.DataEntrada == null)
            {
                throw new Exception("Informe a DATA DE ENTRADA do produto.");
            }
            else if (productModelView.PrecoCompra <= 0)
            {
                throw new Exception("Informe o PREÇO DE COMPRA do produto.");
            }
            else if (productModelView.PrecoVenda <= 0)
            {
                throw new Exception("Informe o PREÇO DE VENDA do produto.");
            }
            else if (productModelView.Icms <= 0)
            {
                throw new Exception("Informeo o ICMS do produto.");
            }
            else if (productModelView.IdLine <= 0)
            {
                throw new Exception("Informe a LINHA do produto.");
            }
            else if (productModelView.IdProvider <= 0)
            {
                throw new Exception("Informe o FORNECEDOR do produto.");
            }
            else
            {
                product1.StatusProduct = productModelView.StatusProduct;
                product1.CodigoBarra   = productModelView.CodigoBarra;
                product1.Nome          = productModelView.Nome;
                product1.Estoque       = productModelView.Estoque;
                product1.Lote          = productModelView.Lote;
                product1.DataValidade  = productModelView.DataValidade;
                product1.DataCadastro  = productModelView.DataCadastro;
                product1.DataEntrada   = productModelView.DataEntrada;
                product1.PrecoCompra   = productModelView.PrecoCompra;
                product1.PrecoVenda    = productModelView.PrecoVenda;
                product1.Desconto      = productModelView.Desconto;
                product1.Icms          = productModelView.Icms;
                product1.IdLine        = productModelView.IdLine;
                product1.IdProvider    = productModelView.IdProvider;
            }

            return(product1);
        }
Ejemplo n.º 29
0
        public async Task <ProductModelView> ProductModelView(string url)
        {
            var viewModel = new ProductModelView();

            using (var httpClient = new HttpClient())
            {
                var fullUrl  = "https://maniastores.bg/razprodajba-drehi-vtora-ruka-online/pregled/" + url;
                var response = await httpClient.GetAsync(fullUrl);

                var content = await response.Content.ReadAsStringAsync();

                var dataString = Regex.Match(content, @"<div class=""product-details-container.*<div class=""products-wrapper")
                                 .ToString();
                viewModel.Name      = url.Split("-p")[0];
                viewModel.ProductId = url.Split("-p")[1];
                var imageUrlsMatches = Regex.Matches(dataString, "data-image=\"(.*?)\"");
                viewModel.FrontPictureSrc = imageUrlsMatches[0].Groups[1].ToString() ?? "";
                viewModel.BackPictureSrc  = imageUrlsMatches[1].Groups[1].ToString() ?? "";
                viewModel.Type            = Regex.Match(dataString, "product-type\">(.*?)</p>").Groups[1].ToString() ?? "";
                viewModel.Brand           = Regex.Match(dataString, "product-brand text-uppercase\">(.*?)</p>").Groups[1].ToString() ?? "";
                viewModel.Status          = Regex.Match(dataString, "product-details-container clearfix (.*?)\"").Groups[1].ToString() ??
                                            "";
                viewModel.Size          = Regex.Match(dataString, "Размер: <strong>(.*?)</strong>").Groups[1].ToString() ?? "";
                viewModel.CurrentPrice  = Regex.Match(dataString, "class=\"price\">(.*?)</div").Groups[1].ToString() ?? "";
                viewModel.StartingPrice = Regex.Match(dataString, "class=\"price old\">(.*?)</div").Groups[1].ToString() ?? "";
                viewModel.Gender        = Regex.Match(dataString, "Пол: </span>(.*?)</p").Groups[1].ToString() ?? "";
                viewModel.Color         = Regex.Match(dataString, "Цвят: </span>(.*?)</p").Groups[1].ToString() ?? "";
                viewModel.Season        = Regex.Match(dataString, "Сезон: </span>(.*?)</p").Groups[1].ToString() ?? "";
                viewModel.Material      = Regex.Match(dataString, "Състав: </span>(.*?)</p").Groups[1].ToString() ?? "";
                viewModel.Description   = Regex.Match(dataString, "Описание: </span>(.*?)</p").Groups[1].ToString() ?? "";
                var condition = Regex.Match(dataString, "Състояние: <img src=\"(.*?)\"").Groups[1].ToString();
                viewModel.Condition = condition != null
                    ? condition.Contains("five")
                        ? "Mrekullueshme"
                        : "Mirë"
                    : "";

                viewModel.DiscountLimit =
                    Regex.Match(dataString, "остъпка от <span class=\"description-label\">(.*?)</span> Повече информация")
                    .Groups[1].ToString() ?? "";
                viewModel.Discount =
                    Regex.Match(dataString, "class=\"sellout-discount\" > (.*?) </div>").Groups[1].ToString() ?? "";
                viewModel.CurrentPriceInLek = viewModel.RoundInLek(viewModel.CurrentPrice.Split(" ")[0]);
                var k = viewModel.StartingPrice.Split(" ")[0];
                viewModel.StartingPriceInLek = viewModel.RoundInLek(viewModel.StartingPrice.Split(" ")[0]);

                var translationStrings = viewModel.Gender + " ? " + viewModel.Description + " ? " + viewModel.Color + " ? " + viewModel.Season + " ? " + viewModel.Material + " ? " + viewModel.Type;

                translationStrings = TranslationService.Translate(translationStrings);

                var values = translationStrings.Split("?");
                viewModel.Gender      = values[0];
                viewModel.Description = values[1];
                viewModel.Color       = values[2];
                viewModel.Season      = values[3];
                viewModel.Material    = values[4];
                viewModel.Type        = values[5];
            }

            return(viewModel);
        }