public void ModificarNoticia([FromBody] Noticias r) { context = HttpContext.RequestServices.GetService(typeof(seygreContext)) as seygreContext; var found = context.Noticias.Find(r.Id); if (r.Nombre != null) { found.Nombre = r.Nombre; } if (r.ImagenUrl != null) { found.ImagenUrl = r.ImagenUrl; } if (r.Descripccion != null) { found.Descripccion = r.Descripccion; } if (r.NoticiaUrl != null) { found.NoticiaUrl = r.NoticiaUrl; } context.Update(found); context.SaveChanges(); }
public void ModificarPersonal([FromBody] Personal r) { context = HttpContext.RequestServices.GetService(typeof(seygreContext)) as seygreContext; //var found = (from e in context.Personal where e.Id.Equals(r.Id) select e).ToList(); var found = context.Personal.Find(r.Id); if (r.Nombre != null) { found.Nombre = r.Nombre; } if (r.Apellidos != null) { found.Apellidos = r.Apellidos; } if (r.Edad != null) { found.Edad = r.Edad; } if (r.Direccion != null) { found.Direccion = r.Direccion; } if (r.IdCargo != null) { found.IdCargo = r.IdCargo; } context.Update(found); context.SaveChanges(); }
public void HabilitarDeshabilitar([FromBody] Centrosacopio r) { context = HttpContext.RequestServices.GetService(typeof(seygreContext)) as seygreContext; var found = context.Centrosacopio.Find(r.Id); if (r.IdEstatus == 1) { found.IdEstatus = 1; } else { found.IdEstatus = 2; } context.Update(found); context.SaveChanges(); }
public void ModificarEvento([FromBody] Eventos r) { context = HttpContext.RequestServices.GetService(typeof(seygreContext)) as seygreContext; //var found = (from e in context.Personal where e.Id.Equals(r.Id) select e).ToList(); var found = context.Eventos.Find(r.Id); if (r.Nombre != null) { found.Nombre = r.Nombre; } if (r.Organizador != null) { found.Organizador = r.Organizador; } if (r.HorarioInicio != null) { found.HorarioInicio = r.HorarioInicio; } if (r.HorarioFinal != null) { found.HorarioFinal = r.HorarioFinal; } if (r.Telefono != null) { found.Telefono = r.Telefono; } if (r.Fecha != null) { found.Fecha = r.Fecha; } if (found.IdEstatus != null) { found.IdEstatus = r.IdEstatus; } context.Update(found); context.SaveChanges(); }