public async Task <IActionResult> Post([FromBody] Aspnetroles role) { //_context.Aspnetroles.Add(role); await _roleManager.CreateAsync(role); //await _context.SaveChangesAsync(); return(Ok(role)); }
public async Task <IActionResult> PutRole([FromRoute] string id, [FromBody] Aspnetroles newrole) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != newrole.Id) { return(BadRequest()); } var role = _roleManager.FindByIdAsync(id).Result; if (role == null) { return(BadRequest("Ruolo non esiste!")); } if (role.Name != newrole.Name) { role.Name = newrole.Name; } try { await _roleManager.UpdateAsync(role); } catch { throw; } return(NoContent()); }
void IRoleService.Inserir(Aspnetroles aspnetroles) { throw new System.NotImplementedException(); }
string IRoleService.Editar(Aspnetroles aspnetroles) { throw new System.NotImplementedException(); }
public void Editar(Aspnetroles aspnetroles) { _context.Update(aspnetroles); _context.SaveChanges(); }
public string Inserir(Aspnetroles aspnetroles) { _context.Add(aspnetroles); _context.SaveChanges(); return(aspnetroles.Id); }