/// <summary> /// Update ProductCategorys /// </summary> /// <param name="entity"></param> /// <returns>Message</returns> public async Task <string> UpdateProductCategorys(ProductCategorys entity) { try { var result = await new ProductCategorysRepository(logger).Update(entity); return(result); } catch (Exception ex) { logger.Error(ex.Message); throw ex; } }
public async Task <ActionResult> Edit(ProductCategorys data) { string result = string.Empty; try { result = await repo.UpdateProductCategorys(data); } catch (Exception ex) { throw; } return(Json(result, JsonRequestBehavior.AllowGet)); }
public async Task <JsonResult> Delete(string ids) { string result = string.Empty; string[] IdList = ids.Split('~'); ProductCategorys vm = new ProductCategorys(); try { result = await repo.IsDeleteProductCategorys(IdList, vm); } catch (Exception ex) { throw; } return(Json(result, JsonRequestBehavior.AllowGet)); }
/// <summary> /// Delete ProductCategorys /// </summary> /// <param name="Id"></param> /// <returns>Message</returns> public async Task <string> IsDeleteProductCategorys(string[] IdList, ProductCategorys entity) { string result = string.Empty; try { for (int i = 0; i < IdList.Length - 1; i++) { result = await new ProductCategorysRepository(logger).IsDelete(Convert.ToInt32(IdList[i]), entity); } } catch (Exception ex) { logger.Error(ex.Message); throw ex; } return(result); }
public static void AddNew() { ProductCategorys entity = new ProductCategorys { CategoryName = "aa", CreatedBy = 1, LevelOrderNo = 1, CreatedDate = DateTime.Now }; IConnectionFactory connectionFactory = new ConnectionMssql { ConnectionString = connStr }; Repository <ProductCategorys> repository = new Repository <ProductCategorys>(connectionFactory); ReturnOutput returnOutput = new ReturnOutput(); repository.Add(entity, ref returnOutput); }
static void Main(string[] args) { ProductCategorys model = new ProductCategorys(); }