public IActionResult EditeSubCategory(SubCategoryEditedVM subCategory) { if (subCategory == null) { return(BadRequest()); } if (!ModelState.IsValid) { return(BadRequest()); } if (PService.UpdateSubCaregory(new SubCategory { CategoryId = subCategory.CategoryId, SubCategoryId = subCategory.SubCategoryId, OrderNumber = subCategory.OrderNumber, Name = subCategory.Name, IsActive = subCategory.IsActive, EName = subCategory.EName, Description = subCategory.Description }, subCategory.SubCategoryId)) { return(RedirectToAction("SubCategory")); } return(BadRequest()); }
public IActionResult EditeSubCategory(int?id) { if (id.HasValue) { var subCategory = PService.GetSubCatrgory(id.Value); if (subCategory != null) { SubCategoryEditedVM editedVM = new SubCategoryEditedVM { CategoryId = subCategory.CategoryId, SubCategoryId = subCategory.SubCategoryId, OrderNumber = subCategory.OrderNumber, Description = subCategory.Description, EName = subCategory.EName, IsActive = subCategory.IsActive, Name = subCategory.Name }; return(View(editedVM)); } } return(BadRequest()); }