예제 #1
0
        public async Task <ApiResponse> Create([FromBody] NotesCreateRequest request)
        {
            try
            {
                var result = await _objControllerHelper.Create(request);

                if (result.Status == NotesCreateStatus.Success)
                {
                    await _hub.Clients.All.SendAsync("newnotesadded", "new notes added");

                    //var values = new SignalRRequest()
                    //{
                    //    isNew = true
                    //};

                    //var data = new StringContent(values.ToString(), Encoding.UTF8, "application/json");

                    //await client.PostAsync("https://patientliveagent.azurewebsites.net/api/AddNewNote?code=h05AWyBIoMxdceyOyVpmMaFIdCbben/4mNGjIEk2T04YYju3eqsgog==", data);
                    ////await client.PostAsync("http://localhost:7071/api/AddNewNote?code=h05AWyBIoMxdceyOyVpmMaFIdCbben/4mNGjIEk2T04YYju3eqsgog==", data);



                    return(new ApiResponse(result));
                }
                return(new ApiResponse(400, result.Error.Message));
            }
            catch (Exception ex)
            {
                throw new ApiException(ex);
            }
        }
        public NewIdResponse Post([FromBody] Note model)
        {
            var id = noteService.Create(
                model.To <BusinessNote>());

            return(new NewIdResponse(id));
        }
예제 #3
0
        public async Task <IActionResult> Post([FromBody] NewNoteDto newNote)
        {
            var createdNote = await _notesService.Create(newNote);

            var noteUri = CreateResourceUri(createdNote.Id);

            return(Created(noteUri, createdNote));
        }
예제 #4
0
        public ActionResult CreateNotes(NoteForCreation noteDto)
        {
            var note = _mapper.Map <Notes>(noteDto);

            _dataService.Create(note);
            return(CreatedAtRoute(
                       nameof(GetNote),
                       new { noteId = note.Id },
                       CreateNoteDto(note)));
        }
        public bool Create()
        {
            string fontFamily = availableFonts[selectedFontIndex];
            int    fontSize   = availableFontSizes[selectedFontSizeIndex];

            try
            {
                UpdatePreferences(fontFamily, fontSize);

                _notesService.Create(name, fontFamily, fontSize);
            }
            catch (ValidationException ex)
            {
                alert.Show(ex.Message);
                return(false);
            }

            return(true);
        }
예제 #6
0
 public IHttpActionResult Create([FromBody] NoteRequest model)
 {
     return(Ok(_notesService.Create(model, User.GetTokenData())));
 }