public async Task <string> AddUpdateSubCategory(SubCategoryDomainModel subCategory) { string status = ""; if (subCategory.subCat_id > 0) { tblSubCategory subCategoryToUpdate = await subCategoryRepository.SingleOrDefault(s => s.subCat_id == subCategory.subCat_id); if (subCategoryToUpdate != null) { subCategoryToUpdate.subCat_id = subCategory.subCat_id; subCategoryToUpdate.name = subCategory.name; subCategoryToUpdate.cat_id = subCategory.cat_id; await subCategoryRepository.Update(subCategoryToUpdate); status = "updated"; } } else { tblSubCategory subCategoryToAdd = new tblSubCategory(); subCategoryToAdd.subCat_id = subCategory.subCat_id; subCategoryToAdd.name = subCategory.name; subCategoryToAdd.cat_id = subCategory.cat_id; await subCategoryRepository.Insert(subCategoryToAdd); status = "added"; } return(status); }
public bool Update(SubCategory obj) { int rowAffected = _Repository.Update(obj); bool isUpdated = rowAffected > 0; return(isUpdated); }
public bool Update(SubCategory subCategory) { bool isUpdated = repository.Update(subCategory); return(isUpdated); ; }
public void Update(SubCategoryViewModel model) { var subCategory = new SubCategory() { Name = model.Name, Id = model.Id, }; _subCategoryRepository.Update(subCategory); }
public IActionResult AddOrUpdate(UISubCategoryListCategory model) { bool b; if (model.SubCategory.Id > 0) { b = repository.Update(model.SubCategory, model.SubCategory.Id); } else { b = repository.Insert(model.SubCategory) > 0; } if (b) { return(RedirectToAction("AllSubCategory")); } return(View("AddOrUpdate")); }
public bool ChangeSubCategory(int id, int categoryId, bool value) { var subCategory = new SubCategoryRepository(); var s = subCategory.GetByColumName("Id", id).FirstOrDefault(); if (s == null) { return(false); } if (value) { s.CategoryId = categoryId; } else { s.CategoryId = 0; } return(subCategory.Update(s, id)); }
public bool Update(SubCategory entity) { return(_subCategoryRepository.Update(entity)); }
public SubCategory Update(SubCategory subCategory) { _subcategoryRepository.Update(subCategory); return(subCategory); }