public IActionResult Put([FromBody] ProductHeight model)
 {
     try
     {
         uow.ProductHeightRepo.Update(model);
         uow.SaveChanges();
         return(Created("/api/productHeight", model));
     }
     catch
     {
         return(StatusCode(500));
     }
 }
 public IActionResult Post([FromBody] ProductHeight model)
 {
     try
     {
         uow.ProductHeightRepo.Add(model);
         uow.SaveChanges();
         return(Created("/api/productHeight", model));
     }
     catch (Exception ex)
     {
         return(StatusCode(500, ex.Message));
     }
 }
        public async Task UpdateHeightAsync(long Id, ProductHeight item)
        {
            var obj = await _productHeightRepository.FindByIdAsync(Id);

            if (obj != null)
            {
                obj.Title        = item.Title != null ? item.Title : obj.Title;
                obj.Status       = item.Status != null ? item.Status : obj.Status;
                obj.DateModified = DateTime.UtcNow;
                _productHeightRepository.Update(obj);
            }
            else
            {
                throw new Exception("Height is not found");
            }
        }
 public async Task AddHeightAsync(ProductHeight item)
 {
     await _productHeightRepository.AddAsync(item);
 }
        internal void AddNewProduct()
        {
            ExcelLib.PopulateInCollection(InventoryTest.ExcelPath, "ProductPage");

            Thread.Sleep(2000);
            //Select Invenotory menu
            Invetory.Click();
            Thread.Sleep(2000);
            //Select Product menu
            Product.Click();
            Thread.Sleep(2000);
            //Select Add New Product from menu
            AddProduct.Click();
            Thread.Sleep(2000);

            //sending product code
            ProductCode.SendKeys(ExcelLib.ReadData(2, "ProductCode"));
            Thread.Sleep(1000);
            //sending product desc
            ProductDesc.SendKeys(ExcelLib.ReadData(2, "ProductDesc"));
            Thread.Sleep(1000);
            //sending barcode
            Barcode.SendKeys(ExcelLib.ReadData(2, "Barcode"));
            Thread.Sleep(1000);
            //sending Unitof measure
            //UnitOfMesureClick.Click();
            //Thread.Sleep(2000);
            //UnitOfMesure.SendKeys(ExcelLib.ReadData(2, "UnitOfMesure"));

            var UnitOfMesure       = CommonMethods.driver.FindElement(By.Id("Product_UnitOfMeasureId"));
            var selectUnitOfMesure = new SelectElement(UnitOfMesure);

            Thread.Sleep(1000);
            selectUnitOfMesure.SelectByText(ExcelLib.ReadData(2, "UnitOfMesure"));


            //sending Product group
            //ProductGrp.SendKeys(ExcelLib.ReadData(2, "ProductGroup"));

            var ProductGrpList  = CommonMethods.driver.FindElement(By.Id("Product_ProductGroupId"));
            var selectProGrpVal = new SelectElement(ProductGrpList);

            Thread.Sleep(1000);
            selectProGrpVal.SelectByText(ExcelLib.ReadData(2, "ProductGroup"));
            Thread.Sleep(1000);
            //sending Pack size
            PackSize.SendKeys(ExcelLib.ReadData(2, "PackSize"));
            Thread.Sleep(1000);
            //Sending Weight
            ProductWeight.SendKeys(ExcelLib.ReadData(2, "ProductWeight"));
            Thread.Sleep(1000);
            //Sending Product width
            ProductWidth.SendKeys(ExcelLib.ReadData(2, "ProductWidth"));
            Thread.Sleep(1000);
            //sending Product Height
            ProductHeight.SendKeys(ExcelLib.ReadData(2, "ProductHeight"));
            Thread.Sleep(1000);
            //sending ProductDepth
            ProductDepth.SendKeys(ExcelLib.ReadData(2, "ProductDepth"));
            Thread.Sleep(1000);

            ////select Types
            //NeverDimishing.Click();
            //Thread.Sleep(1000);
            ////CommonMethods.driver.SwitchTo().Alert().Dismiss();
            //Obsolete.Click();
            //Thread.Sleep(1000);
            ////CommonMethods.driver.SwitchTo().Alert().Dismiss();

            //Sending Notes
            Notes.SendKeys(ExcelLib.ReadData(2, "Notes"));
            //savedata
            SaveBtn.Click();
            Thread.Sleep(2000);
            ProductView.Click();
            Thread.Sleep(1000);
            ProductCodeFilter.SendKeys(ExcelLib.ReadData(2, "ProductCode"));
            Thread.Sleep(1000);
            //press enter
            ProductCodeFilter.SendKeys(Keys.Enter);
            Thread.Sleep(4000);


            try
            {
                //verify record is added
                if (ExcelLib.ReadData(2, "ProductCode") == CommonMethods.driver.FindElement(By.XPath(".//*[@id='ProductList_tccell0_2']/div/a")).Text)
                {
                    if (ExcelLib.ReadData(2, "ProductDesc") == CommonMethods.driver.FindElement(By.XPath(".//*[@id='ProductList_tccell0_3']/div/a")).Text)
                    {
                        if (ExcelLib.ReadData(2, "ProductGrp") == CommonMethods.driver.FindElement(By.XPath(".//*[@id='ProductList_tccell0_3']/div/a")).Text)
                        {
                            SaveScreenShotClass.SaveScreenshot(CommonMethods.driver, "Found Added Product ");
                        }
                    }
                }
                else
                {
                    SaveScreenShotClass.SaveScreenshot(CommonMethods.driver, "No record found ");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Can not find added Product,Test failed" + e.Message);
            }
        }
Beispiel #6
0
 public void Update(ProductHeight productHeight)
 {
     _productHeightRepository.Update(productHeight);
 }
Beispiel #7
0
 public ProductHeight Add(ProductHeight productHeight)
 {
     return(_productHeightRepository.Add(productHeight));
 }