Exemplo n.º 1
0
 public void UpdateFromDto(EntryDto dto)
 {
     Title = dto.Title;
     Tags  = dto.Tags;
     Body  = dto.Body;
     Update();
 }
Exemplo n.º 2
0
        public async Task <IActionResult> UpdateEntry(int id, [FromBody] EntryDto dto)
        {
            if (ModelState.IsValid)
            {
                var result = await _service.Update(id, dto);

                if (result != null)
                {
                    return(Ok(result));
                }

                return(BadRequest(new { Message = "Unable to update entry" }));
            }

            return(BadRequest(ModelState));
        }