public ActionResult Create([FromBody] PersonageDto dto) { var personage = new Personage(dto.Nome, dto.Sexo, dto.DataNascimento, dto.Latitude, dto.Longitude); _personagesCollection.InsertOne(personage); return(StatusCode(201, "Personage adicinado com sucesso.")); }
public ActionResult Update(string id, PersonageDto personageIn) { var p = _personagesCollection.Find <Personage>(personage => personage.Id == id).FirstOrDefault(); if (p == null) { return(NotFound()); } var personage = new Personage(personageIn.Nome, personageIn.Sexo, personageIn.DataNascimento, personageIn.Latitude, personageIn.Longitude); personage.Id = id; _personagesCollection.ReplaceOne(personage => personage.Id == id, personage); return(NoContent()); }