public IActionResult Delete(int codeId) { // User loggedInUser = _userRepository.GetUserById(_userRepository.GetUserBySessionId()); // Why get the logged in user? Code codeToDelete = _codeRepository.GetCodeById(codeId); if (codeToDelete != null) { _codeRepository.DeleteCode(codeId); return(RedirectToAction("Index", "Code")); } ViewBag.ErrorMessage = "Attempt to delete a null code segment"; return(View()); } // end get Delete
public void DeleteCode(Codes code) { codeRepository.DeleteCode(code); }