public async Task <ActionResult> GetGroup(int id) { var selectedGroup = await _context.PermissionsGroups.FirstOrDefaultAsync(p => p.Id == id); PermissionGroupForReadandUpdateDto group = new PermissionGroupForReadandUpdateDto() { Id = selectedGroup.Id, Name = selectedGroup.Name, Permissions = JsonConvert.DeserializeObject <List <PermissionDto> >(selectedGroup.RolContent) }; return(Ok(group)); }
public async Task <ActionResult> defaultUpdate(int id, [FromBody] PermissionGroupForReadandUpdateDto group) { var findedGroup = await _context.PermissionsGroups.FirstOrDefaultAsync(p => p.Id == id); if (findedGroup == null) { return(BadRequest("Tapilmadi")); } findedGroup.Name = group.Name; findedGroup.RolContent = JsonConvert.SerializeObject(group.Permissions); _context.Entry(findedGroup).State = EntityState.Modified; await _context.SaveChangesAsync(); return(Ok()); }