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"
            });
        }
예제 #2
0
 public NoteModel Map(NoteDAL noteDal)
 {
     return(new NoteModel
     {
         NoteId = noteDal.NoteId,
         Title = noteDal.Title,
         Text = noteDal.Text,
         IsPublic = noteDal.IsPublic
     });
 }
예제 #3
0
 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"));
     }
 }
예제 #4
0
        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));
        }
예제 #5
0
 public async Task <IActionResult> CreateNote(NoteDAL newNote)
 {
     try
     {
         return(Ok(NotesService.CreateNote(newNote)));
     }
     catch (NoteAlreadyExistsException)
     {
         return(BadRequest("A Note with that name already exists."));
     }
 }
예제 #6
0
        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);
        }
예제 #7
0
 public static List <Note> getNotes(int taskID, int subtaskID)
 {
     return(NoteDAL.getNotes(taskID, subtaskID));
 }
예제 #8
0
 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)));
 }
예제 #9
0
 public static void DeleteNote(string IDs)
 {
     NoteDAL.DeleteNote(IDs);
 }
예제 #10
0
 public static void UpdateVisitNote(string ID, string body, decimal num, string contactor, string contactorType, string contractResult)
 {
     NoteDAL.UpdateVisitNote(ID, body, num, contactor, contactorType, contractResult);
 }
예제 #11
0
파일: NoteObject.cs 프로젝트: blfsir/benzoa
 public static string UpdateNote(object[] param)
 {
     NoteDAL obj = new NoteDAL();
        return obj.UpdateNote(param, "exit");
 }
예제 #12
0
 public static DataSet GetNoteByID(string id)
 {
     return(NoteDAL.GetNoteList("ID=" + id));
 }
예제 #13
0
파일: NoteObject.cs 프로젝트: blfsir/benzoa
 public static string InsertNote(object[] param)
 {
     NoteDAL obj = new NoteDAL();
        return obj.InsertNote(param, "exit");
 }
예제 #14
0
파일: NoteObject.cs 프로젝트: blfsir/benzoa
 public static string CollectNote(object[] param)
 {
     NoteDAL obj = new NoteDAL();
        return obj.CollectNote(param, "exit");
 }
예제 #15
0
 public static DataSet GetNoteList()
 {
     return(NoteDAL.GetNoteList());
 }
예제 #16
0
 public static DataSet GetNoteListByCaseID(string CompanyID, string CaseID)
 {
     string where = "CompanyID= {1} and CaseID={0}";
     return(NoteDAL.GetNoteList(string.Format(where, CaseID, CompanyID)));
 }
예제 #17
0
 public static DataSet GetNoteList(string where)
 {
     return(NoteDAL.GetNoteList(where));
 }
예제 #18
0
 public NoteController()
 {
     _noteDal = new NoteDAL();
 }
예제 #19
0
 public static int GetNoteTotalItems(string where)
 {
     return(NoteDAL.GetNoteTotalItems(where));
 }
예제 #20
0
파일: NoteObject.cs 프로젝트: blfsir/benzoa
 public static DataTable GetNoteListByUserID(object[] param)
 {
     NoteDAL obj = new NoteDAL();
     return obj.GetNoteListByUserID(param);
 }
예제 #21
0
 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));
 }
예제 #22
0
파일: NoteObject.cs 프로젝트: blfsir/benzoa
 public static DataTable SearchNote(object[] param)
 {
     NoteDAL obj = new NoteDAL();
        return obj.SearchNote(param);
 }
예제 #23
0
 public static void UpdateNote(string ID, string body)
 {
     NoteDAL.UpdateNote(ID, body);
 }
예제 #24
0
 public Note CreateNote(NoteDAL newNote)
 {
     return(new Note(newNote.Name, newNote.Content, Filepath, Id));
 }
예제 #25
0
 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);
 }