Ejemplo n.º 1
0
        public string CreateAccount(Account account)
        {
            if (_accountDal.IsExists(x => x.Email == account.Email))
            {
                return("Email Already Exists");
            }
            if (_accountDal.IsExists(x => x.Username == account.Username))
            {
                return("Username already Exists");
            }
            account.Salt     = CommonBLL.CreateSalt();
            account.Password = CommonBLL.CreatePasswordHash(account.Password, account.Salt);
            if (account.File != null)
            {
                account.ImagePath = CommonBLL.UploadImage(account.File, "DP");
            }

            account.IsActive = true;
            int returnValue = _accountDal.Insert(account);

            if (returnValue > 0)
            {
                return("Success");
            }
            return("There is some issue please try Again");
        }
Ejemplo n.º 2
0
        public int EditProfile(Account account)
        {
            if (account.File != null)
            {
                File.Delete(HttpContext.Current.Server.MapPath(account.ImagePath));

                account.ImagePath = CommonBLL.UploadImage(account.File, "DP");
            }
            return(_accountDal.Edit(account));
        }
Ejemplo n.º 3
0
        public int EditProduct(Product product)
        {
            if (product.Files != null)
            {
                List <ProductImage> productImages = new List <ProductImage>();
                foreach (var item in product.Files)
                {
                    ProductImage productImage = new ProductImage();
                    productImage.ImagePath = CommonBLL.UploadImage(item, "ProductImages");
                    productImage.ProductId = product.Id;
                    productImages.Add(productImage);
                }
                _productImageDal.InsertList(productImages);
            }

            return(_productDal.Edit(product));
        }
Ejemplo n.º 4
0
        public string AddProduct(Product product)
        {
            if (_productDal.Insert(product) > 0)
            {
                if (product.Files != null)
                {
                    List <ProductImage> productImages = new List <ProductImage>();
                    foreach (var item in product.Files)
                    {
                        ProductImage productImage = new ProductImage();
                        productImage.ImagePath = CommonBLL.UploadImage(item, "ProductImages");
                        productImage.ProductId = product.Id;
                        productImages.Add(productImage);
                    }
                    _productImageDal.InsertList(productImages);
                }

                return("Success");
            }
            else
            {
                return("There is some Issue Please try after some time");
            }
        }