public RegionDto updateRegion(RegionDto RegionDto) { RegionModificado = RegionDto; using (NuevoDbContext context = new NuevoDbContext()) { //load task from database RegionDto Region = context.getRegiones(true).Where(t => t.Id == RegionDto.Id).FirstOrDefault(); RegionOriginal = Region; prepararCambios(RegionModificado, RegionOriginal, context); var idRegionAModificarr = Region.Id; Region.Nombre = RegionDto.Nombre.Trim().ToUpper(); Region.Deleted = RegionDto.Deleted; //save changes to database context.SaveChanges(); context.CommonChangeLogger.AddRange(listLoggers); context.SaveChanges(); return(Region); } }