public async Task <IActionResult> PutLogin(long id, Login login) { if (id != login.Id) { return(BadRequest()); } _context.Entry(login).State = EntityState.Modified; var user = _context.Logins.Find(id); user.Email = login.Email; user.Senha = login.Senha; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LoginExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutNoticia(long id, Noticia noticia) { if (id != noticia.Id) { return(BadRequest()); } _context.Entry(noticia).State = EntityState.Modified; var news = _context.Noticias.Find(id); news.Titulo = noticia.Titulo; news.Texto = noticia.Texto; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!NoticiaExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }