Exemplo n.º 1
0
        public async Task <int> InsertProductType(ProductTypeCreateModel input)
        {
            using var conn = await _dbConnection.CreateConnectionAsync();

            var db             = new QueryFactory(conn, new SqlServerCompiler());
            var affectedRecord = await db.Query("ProductType").InsertAsync(new ProductTypeModel
            {
                ProductTypeID   = Guid.NewGuid(),
                ProductTypeKey  = input.ProductTypeKey,
                ProductTypeName = input.ProductTypeName,
                RecordStatus    = input.RecordStatus,
                CreatedDate     = DateTime.Now,
            });

            return(await Task.FromResult(affectedRecord));
        }
        public IActionResult CreateProduct(ProductTypeCreateModel productTypeCreate)
        {
            var validator = new ProductCreateValidator();

            if (validator.Validate(productTypeCreate).IsValid)
            {
                var productType = this._mapper.Map <ProductTypeCreateModel, ProductType>(productTypeCreate);
                if (this._uow.ProductTypeRepository.Save(productType))
                {
                    return(RedirectToAction("CreatePost", "Post"));
                }
                else
                {
                    return(RedirectToAction("CreateProduct"));
                }
            }
            return(RedirectToAction("CreateProduct"));
        }
Exemplo n.º 3
0
        public ProductProfile()
        {
            var t = new ProductTypeCreateModel();

            this.CreateMap <ProductTypeCreateModel, ProductType>();
        }
Exemplo n.º 4
0
        public async Task <int> InsertProductType(ProductTypeCreateModel input)
        {
            var id = await _productTypeQuery.InsertProductType(input);

            return(await Task.FromResult(id));
        }