public ActionResult Edit(NoteModel noteModel) { if (ModelState.IsValid) { noteModel.UpdateAt = DateTime.Now; Note note = noteModel.ToEntity(); noteService.Update(note); return(RedirectToAction("Index")); } return(View(noteModel)); }
public ActionResult Create(NoteModel noteModel) { if (ModelState.IsValid) { noteModel.NoteID = Guid.NewGuid().ToString(); noteModel.CreateAt = DateTime.Now; noteModel.UpdateAt = DateTime.Now; Note note = noteModel.ToEntity(); noteService.Create(note); return(RedirectToAction("Index")); } return(View(noteModel)); }