public async Task <RequestResultModel> AddNotes(NoteModel note, Guid userId) { NoteDAL noteDAL = _mapService.MapToDAL(note); noteDAL.UserId = userId; try { await _secureContext.AddAsync(noteDAL); await _secureContext.SaveChangesAsync(); } catch { return(new RequestResultModel { IsSuccess = false, Message = "Can not save the note" }); } return(new RequestResultModel { IsSuccess = true, Message = "Note uploaded" }); }
public NoteModel Map(NoteDAL noteDal) { return(new NoteModel { NoteId = noteDal.NoteId, Title = noteDal.Title, Text = noteDal.Text, IsPublic = noteDal.IsPublic }); }
public async Task <IActionResult> UpdateNote(string id, NoteDAL newNote) { try { return(Ok(NotesService.UpdateNote(id, newNote))); } catch (NoteNotFound) { return(BadRequest("A note with that id doesn't exist")); } }
internal static Note CreateNote(NoteDAL newNote) { var notes = new Notes(); Folder parent = Folder.AllFolders.Where(x => x.Id == newNote.ParentId).FirstOrDefault(); if (parent == null) { throw new FolderNotFound(); } return(parent.CreateNote(newNote)); }
public async Task <IActionResult> CreateNote(NoteDAL newNote) { try { return(Ok(NotesService.CreateNote(newNote))); } catch (NoteAlreadyExistsException) { return(BadRequest("A Note with that name already exists.")); } }
internal static Note UpdateNote(string id, NoteDAL newNote) { Notes notes = new Notes(); Note targetNote = notes.AllNotes.FirstOrDefault(x => x.Id == id); if (targetNote == null) { throw new NoteNotFound(); } // Note moved if (newNote.ParentId != null && targetNote.ParentId != newNote.ParentId) { Folder parent = Folder.AllFolders.Where(x => x.Id == newNote.ParentId).FirstOrDefault(); if (parent == null) { throw new FolderNotFound(); } targetNote.Move(parent); } // Note renamed if (newNote.Name != null && targetNote.Name != newNote.Name) { targetNote.Rename(newNote.Name); } // Content change if (newNote.Content != null && targetNote.Content != newNote.Content) { targetNote.Content = newNote.Content; targetNote.Save(); } return(targetNote); }
public static List <Note> getNotes(int taskID, int subtaskID) { return(NoteDAL.getNotes(taskID, subtaskID)); }
public static DataSet GetNoteListByCaseType(string CompanyID, string CaseID, int type) { string where = "CompanyID= {1} and CaseID={0} and NoteType={2} "; return(NoteDAL.GetNoteList(string.Format(where, CaseID, CompanyID, type))); }
public static void DeleteNote(string IDs) { NoteDAL.DeleteNote(IDs); }
public static void UpdateVisitNote(string ID, string body, decimal num, string contactor, string contactorType, string contractResult) { NoteDAL.UpdateVisitNote(ID, body, num, contactor, contactorType, contractResult); }
public static string UpdateNote(object[] param) { NoteDAL obj = new NoteDAL(); return obj.UpdateNote(param, "exit"); }
public static DataSet GetNoteByID(string id) { return(NoteDAL.GetNoteList("ID=" + id)); }
public static string InsertNote(object[] param) { NoteDAL obj = new NoteDAL(); return obj.InsertNote(param, "exit"); }
public static string CollectNote(object[] param) { NoteDAL obj = new NoteDAL(); return obj.CollectNote(param, "exit"); }
public static DataSet GetNoteList() { return(NoteDAL.GetNoteList()); }
public static DataSet GetNoteListByCaseID(string CompanyID, string CaseID) { string where = "CompanyID= {1} and CaseID={0}"; return(NoteDAL.GetNoteList(string.Format(where, CaseID, CompanyID))); }
public static DataSet GetNoteList(string where) { return(NoteDAL.GetNoteList(where)); }
public NoteController() { _noteDal = new NoteDAL(); }
public static int GetNoteTotalItems(string where) { return(NoteDAL.GetNoteTotalItems(where)); }
public static DataTable GetNoteListByUserID(object[] param) { NoteDAL obj = new NoteDAL(); return obj.GetNoteListByUserID(param); }
public static int InsertNote(string Body, string CreateBy, int NoteType, int CaseID, decimal Num1, string Str1, string Str2, DateTime Date1, DateTime CreateOn, int CompanyID, string contactor, string contactorType, string contractResult) { return(NoteDAL.InsertNote(Body, CreateBy, NoteType, CaseID, Num1, Str1, Str2, Date1, CreateOn, CompanyID, contactor, contactorType, contractResult)); }
public static DataTable SearchNote(object[] param) { NoteDAL obj = new NoteDAL(); return obj.SearchNote(param); }
public static void UpdateNote(string ID, string body) { NoteDAL.UpdateNote(ID, body); }
public Note CreateNote(NoteDAL newNote) { return(new Note(newNote.Name, newNote.Content, Filepath, Id)); }
public static void UpdateNote(string ID, string body, string tel, string phoneType, string contactor, string contactorType, string contractResult) { NoteDAL.UpdateNote(ID, body, tel, phoneType, contactor, contactorType, contractResult); }