public IActionResult Create(NotesViewModel notes) { try { var noteNameExists = _INotes.checkNotenameExists(notes.dbModel.note); if (noteNameExists) { TempData["MessageRegistration"] = "Note Name already exists."; } else { notes.dbModel.created_at = notes.dbModel.updated_at = DateTime.Now; if (_INotes.Commit(notes.dbModel, 0) > 0) { TempData["MessageRegistration"] = "Note Name successfully added."; return(RedirectToAction("Index")); } else { return(View(notes.dbModel)); } } return(View(notes.dbModel)); } catch (Exception) { throw; } }