public IActionResult Upsert(int?id) { BulkyBook.Models.CoverType cover = new BulkyBook.Models.CoverType(); //SOME ERROR with Single class initialization. if (id == null) { // Create return(View(cover)); } // Update cover = _coverTypeRepository.GetById(id.GetValueOrDefault()); if (cover == null) { // Incorrect ID return(NotFound()); } return(View(cover)); }