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
     });
 }
Esempio n. 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"));
     }
 }
Esempio n. 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));
        }
Esempio n. 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."));
     }
 }
Esempio n. 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);
        }
Esempio n. 7
0
 public static List <Note> getNotes(int taskID, int subtaskID)
 {
     return(NoteDAL.getNotes(taskID, subtaskID));
 }
Esempio n. 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)));
 }
Esempio n. 9
0
 public static void DeleteNote(string IDs)
 {
     NoteDAL.DeleteNote(IDs);
 }
Esempio n. 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);
 }
Esempio n. 11
0
 public static string UpdateNote(object[] param)
 {
     NoteDAL obj = new NoteDAL();
        return obj.UpdateNote(param, "exit");
 }
Esempio n. 12
0
 public static DataSet GetNoteByID(string id)
 {
     return(NoteDAL.GetNoteList("ID=" + id));
 }
Esempio n. 13
0
 public static string InsertNote(object[] param)
 {
     NoteDAL obj = new NoteDAL();
        return obj.InsertNote(param, "exit");
 }
Esempio n. 14
0
 public static string CollectNote(object[] param)
 {
     NoteDAL obj = new NoteDAL();
        return obj.CollectNote(param, "exit");
 }
Esempio n. 15
0
 public static DataSet GetNoteList()
 {
     return(NoteDAL.GetNoteList());
 }
Esempio n. 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)));
 }
Esempio n. 17
0
 public static DataSet GetNoteList(string where)
 {
     return(NoteDAL.GetNoteList(where));
 }
Esempio n. 18
0
 public NoteController()
 {
     _noteDal = new NoteDAL();
 }
Esempio n. 19
0
 public static int GetNoteTotalItems(string where)
 {
     return(NoteDAL.GetNoteTotalItems(where));
 }
Esempio n. 20
0
 public static DataTable GetNoteListByUserID(object[] param)
 {
     NoteDAL obj = new NoteDAL();
     return obj.GetNoteListByUserID(param);
 }
Esempio n. 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));
 }
Esempio n. 22
0
 public static DataTable SearchNote(object[] param)
 {
     NoteDAL obj = new NoteDAL();
        return obj.SearchNote(param);
 }
Esempio n. 23
0
 public static void UpdateNote(string ID, string body)
 {
     NoteDAL.UpdateNote(ID, body);
 }
Esempio n. 24
0
 public Note CreateNote(NoteDAL newNote)
 {
     return(new Note(newNote.Name, newNote.Content, Filepath, Id));
 }
Esempio n. 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);
 }