public void AddNote(string noteName, string description, string urgency, int projectId)
 {
     _notesRepo.AddNote(new NotesDTO()
     {
         NoteName = noteName, Description = description, Urgency = urgency, ProjectId = projectId
     });
 }
Esempio n. 2
0
 public ActionResult Add(NoteViewModel noteView, string submitButton)
 {
     if (ModelState.IsValid)
     {
         if (HttpContext.Session["UserId"] == null)
         {
             return(RedirectToAction("Login", "Account"));
         }
         var userId    = HttpContext.Session["UserId"].ToString();
         var noteToAdd = new Note
         {
             UserId     = Convert.ToInt32(userId),
             CreatedUTC = DateTime.UtcNow,
             NoteText   = noteView.NoteText
         };
         var valid = _accountRepo.CheckValidForTransaction(Convert.ToInt32(userId), RequestHelpers.RequestIPAddress());
         if (!valid)
         {
             return(RedirectToAction("IpBlocked", "Account"));
         }
         var isSuccess = _notesRepo.AddNote(noteToAdd, RequestHelpers.RequestIPAddress());
         if (isSuccess && submitButton == "Save")
         {
             return(RedirectToAction("Index", "Notes"));
         }
         else
         {
             return(RedirectToAction("Add", "Notes"));
         }
     }
     else
     {
         return(View(noteView));
     }
 }
Esempio n. 3
0
        public Boolean AddNoteService(NoteDTO note)
        {
            if (note.Id < 0)
            {
                throw new ArgumentOutOfRangeException();
            }

            return(_notesRepository.AddNote(note));
        }
Esempio n. 4
0
        public async Task <StatusCodeResult> AddNote()
        {
            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
            var    srcEncoding = Encoding.GetEncoding(1251);
            string noteStr     = await new StreamReader(Request.Body, srcEncoding).ReadToEndAsync();

            _notesRepository.AddNote(noteStr);
            return(Ok());
        }
Esempio n. 5
0
        public Note AddNote(int AccountId, NoteForCloud noteFromCloud, string email)
        {
            string url  = _cloudForImages.UploadToCloud(noteFromCloud.Image, email);
            Note   note = new Note {
                Title = noteFromCloud.Title, Description = noteFromCloud.Description, IsPin = noteFromCloud.IsPin, Remainder = noteFromCloud.Remainder,
                Image = url
            };

            return(_notesRepository.AddNote(AccountId, note));
        }
Esempio n. 6
0
        public async Task <StatusCodeResult> AddNote()
        {
            Note note = new Note();

            using (StreamReader inputStream = new StreamReader(Request.Body, Encoding.UTF8))
            {
                note.content = await inputStream.ReadToEndAsync();
            }
            _notesRepository.AddNote(note);
            return(Ok());
        }
Esempio n. 7
0
        public async Task <NoteResponseDto> AddNote(NoteRequestDto note, int userid, string email)
        {
            Note noteModel = _mapper.Map <Note>(note);

            noteModel.AccountId = userid;
            if (noteModel.Image != null && noteModel.Image.Length > 0)
            {
                noteModel.Image = await _cloudService.UpdloadToCloud(note.Image, email);
            }
            return(_mapper.Map <NoteResponseDto>(await _repository.AddNote(noteModel)));
        }
Esempio n. 8
0
        private void AddButton_OnClick(object sender, RoutedEventArgs e)
        {
            var dialog = new CreateNoteDialog();

            if (dialog.ShowDialog() == true)
            {
                var createArgs = dialog.Result();
                var id         = NotesRepository.AddNote(createArgs);
                var item       = new NoteTreeItem(this, id);
                NotesTree.Items.Add(item);
                item.IsSelected = true;
            }
        }
Esempio n. 9
0
        public async Task <StatusCodeResult> AddNote()
        {
            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
            string noteStr = await new StreamReader(Request.Body, Encoding.GetEncoding(1251)).ReadToEndAsync();

            if (string.IsNullOrEmpty(noteStr))
            {
                return(BadRequest());
            }

            _notesRepository.AddNote(noteStr);
            return(Ok());
        }
Esempio n. 10
0
 public Notes AddNote(Notes note)
 {
     try
     {
         Notes newNotes = _notesRepository.AddNote(note);
         return(note);
     }
     catch (Exception ex)
     {
         _logger.LogError("Error in add new note");
         _logger.LogError(ex.Message);
         return(null);
     }
 }
Esempio n. 11
0
        public async Task AddNote(NoteDto noteDto)
        {
            if (noteDto != null)
            {
                if (string.IsNullOrEmpty(noteDto.Text))
                {
                    throw new Exception("Text is empty");
                }

                var newNote = _mapper.Map <Note>(noteDto);

                newNote.Date = DateTime.Now;

                await _repo.AddNote(newNote);

                if (!await _repo.SaveAll())
                {
                    throw new Exception("Saving error");
                }
            }
        }