private List <ProductsBE> TableToBE(DataTable table) { List <ProductsBE> returnBE = new List <ProductsBE>(); foreach (DataRow row in table.Rows) { ProductsBE be = new ProductsBE(); be.Id = row.Table.Columns.Contains("Id") ? DataProvider.GetDBInteger(row, "Id") : -1; be.Name = row.Table.Columns.Contains("Name") ? DataProvider.GetDBString(row, "Name") : string.Empty; be.Description = row.Table.Columns.Contains("Description") ? DataProvider.GetDBString(row, "Description") : string.Empty; be.Price = row.Table.Columns.Contains("Price") ? DataProvider.GetDBInteger(row, "Price") : -1; be.CreatedDate = row.Table.Columns.Contains("CreatedDate") ? DataProvider.GetDBDateTime(row, "CreatedDate") : new DateTime(); be.CreatedBy = row.Table.Columns.Contains("CreatedBy") ? DataProvider.GetDBString(row, "CreatedBy") : string.Empty; be.ImageValue = row.Table.Columns.Contains("ImageValue") ? DataProvider.GetDBString(row, "ImageValue") : string.Empty; returnBE.Add(be); } return(returnBE); }
public JsonResult UpdateProduct(ProductsBE product) { bool isSuccess = this.shopBUS.UpdateProduct(product); return(Json(isSuccess, JsonRequestBehavior.AllowGet)); }
public JsonResult CreateNewProduct(ProductsBE product) { int productId = this.shopBUS.CreateNewProduct(product); return(Json(productId, JsonRequestBehavior.AllowGet)); }
public bool UpdateProduct(ProductsBE product) { int noOfSuccess = shopDAL.UpdateProduct(product.Id, product.Name, product.Price, product.ImageValue); return(noOfSuccess > 0 ? true : false); }
public int CreateNewProduct(ProductsBE product) { int productId = shopDAL.CreateNewProduct(product.Name, product.Price, product.ImageValue); return(productId); }
public ShopModel() { products = new List <ProductsBE>(); productBE = new ProductsBE(); }