public async Task <ActionResult> Create(ProductAdderVM product)
        {
            if (ModelState.IsValid)
            {
                if (await _adminProductService.SaveDataAsync(product) > 0)
                {
                    return(RedirectToAction("Index", new { status = StatusMessageId.AddSuccess }));
                }

                return(RedirectToAction("Index", new { status = StatusMessageId.Error }));
            }
            ModelState.AddModelError("Error", "Cannot save your product");
            return(View());
        }
        public async Task <int> SaveDataAsync(ProductAdderVM viewModel)
        {
            var adder = _mapper.Map <ProductAdder>(viewModel);

            adder.PurchaseDate = DateTime.Now;
            var product = await _productRepository.GetProductByAdderAsync(adder, EntityExtensions.ConvertToUnSign(adder.Name));

            if (product != null)
            {
                product.AvailableQuantity += adder.AvailableQuantity;

                await _productAdderRepository.AddAsync(adder);

                await _productRepository.UpdateAsync(product);

                return(await _unitOfWork.SaveAsync());
            }
            return(0);
        }