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
 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
 public static string InsertNote(object[] param)
 {
     NoteDAL obj = new NoteDAL();
        return obj.InsertNote(param, "exit");
 }
Пример #14
0
 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
 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
 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);
 }