public ActionResult <Note> Add([FromBody] NoteDtoAdd model) { var result = _notesRepository.Add(model); if (result == null) { BadRequest(); } return(Ok(result)); }
public Note Add(NoteDtoAdd model) { var noteToAdd = new Note { Title = model.Title, Description = model.Description, Created = DateTime.Now, DueDate = model.DueDate }; _dataDbContext.Notes.Add(noteToAdd); _dataDbContext.SaveChanges(); return(noteToAdd); }
public Note Add(NoteDtoAdd model) { try { Note note = new Note { Id = Guid.NewGuid(), Created = DateTime.Now, Title = model.Title, Description = model.Description, DueDate = model.DueDate }; StaticDB.Notes.Add(note); return(note); } catch (Exception) { return(null); } }
public ActionResult <Note> Add([FromBody] NoteDtoAdd model) { Note newNote = new Note { Id = Guid.NewGuid(), Created = DateTime.Now, Title = model.Title, Description = model.Description, DueDate = model.DueDate }; try { StaticDB.Notes.Add(newNote); } catch (Exception ex) { return(this.StatusCode(int.Parse(HttpStatusCode.InternalServerError.ToString()), ex.Message)); } return(Ok(newNote)); }
public Note Add(NoteDtoAdd model) => _notesRepository.Add(model);
public Note Add(NoteDtoAdd model) { throw new NotImplementedException(); }