예제 #1
0
        public JsonResult DeleteNote(int id)
        {
            try
            {
                Note note = new Note(id);
                note.Delete();

                return new JsonResult { Data = new { success = true } }; // Return nothing as there are no errors
            }
            catch (Exception ex)
            {
                return new JsonResult { Data = new { success = false, error = ex.Message } };
            }
        }
예제 #2
0
        public JsonResult SaveNote(Note Note, int TypeId)
        {
            try
            {
                Note.TypeId = (NoteType)TypeId;
                Note.UserId = Membership.GetUser(User.Identity.Name).ProviderUserKey.ToString();
                Note.UserName = User.Identity.Name;
                Note.Save();

                Note.Message = Note.DisplayHtmlMessage(); // For display

                return new JsonResult { Data = new { success = true, note = Note } }; // Return the note Id if there are no errors
            }
            catch (Exception ex)
            {
                return new JsonResult { Data = new { success = false, error = ex.Message } };
            }
        }