public IActionResult Edit([FromBody] WikiCategoryViewModel model, int id) { Console.WriteLine("Trying to update wiki category"); if (!ModelState.IsValid) { Console.WriteLine("ModelState is not valid"); return(BadRequest(ModelState)); } var category = repository.GetWikiCategoryById(id); if (category != null) { category.Name = model.Name; category.CategoryUrl = model.CategoryUrl; category.ImageUrl = model.ImageUrl; category.ImagePlaceholder = model.ImagePlaceholder; category.ImageName = model.ImageName; category.ImagePath = model.ImagePath; if (repository.SaveAll()) { return(new OkObjectResult("Successfully saved category inside")); } } Console.WriteLine("Successfully saved category outside"); return(new OkObjectResult("Successfully saved category outside")); }