public IActionResult Put(string id, [FromBody]HymnModel titleIn)
        {
            var title = _hymnService.Get(id);

            if (title == null)
            {
                return NotFound();
            }

            _hymnService.Update(id, titleIn);

            return NoContent();
        }
 public ActionResult<HymnModel> Post([FromBody]HymnModel title)
 {
     _hymnService.Create(title);
     return CreatedAtRoute("", new { id = title.Id.ToString() }, title);
 }
Exemplo n.º 3
0
 public void Update(string id, HymnModel hymnIn) =>
 _hymns.ReplaceOne(hymn => hymn.Id == id, hymnIn);
Exemplo n.º 4
0
 public void Delete(HymnModel hymnIn) =>
 _hymns.DeleteOne(hymn => hymn.Id == hymnIn.Id);
Exemplo n.º 5
0
 public HymnModel Create(HymnModel hymn)
 {
     _hymns.InsertOne(hymn);
     return(hymn);
 }