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")); }
public ProductProfile() { var t = new ProductTypeCreateModel(); this.CreateMap <ProductTypeCreateModel, ProductType>(); }
public async Task <int> InsertProductType(ProductTypeCreateModel input) { var id = await _productTypeQuery.InsertProductType(input); return(await Task.FromResult(id)); }