public async Task <IActionResult> PutProyects([FromRoute] int id, [FromBody] Proyects proyects) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != proyects.Id) { return(BadRequest()); } _context.Entry(proyects).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProyectsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostProyects([FromBody] Proyects proyects) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Proyects.Add(proyects); await _context.SaveChangesAsync(); return(CreatedAtAction("GetProyects", new { id = proyects.Id }, proyects)); }
async void AgregarProyecto() { IsRefreshing = true; Proyects.Add(new Proyecto() { EstatusIntegracion = "", FechaIntegracion = DateTime.Now.ToString(), FechaSalida = DateTime.Now.ToString(), NombreProyecto = "", RazonSalida = "", }); HeighListView = HeighListView + 47; IsRefreshing = false; }
async void LoadProyectos() { if (Application.Current.Properties.ContainsKey("ContadorProyectos")) //contador de la cantidad de elementos en la lista { Elementos = int.Parse((Application.Current.Properties["ContadorProyectos"]) as string); } else { Elementos = 0; } IsRefreshing = true; for (int j = 0; j < Elementos; j++) //Elementos va a representar el total de elementos o filas existentes en mi persistencia { if (Application.Current.Properties.ContainsKey("NombreProyecto" + j)) { nombreproyecto = (Application.Current.Properties["NombreProyecto" + j]) as string; } else { nombreproyecto = ""; } if (Application.Current.Properties.ContainsKey("FechaIntegracion" + j)) { fechaintegracion = (Application.Current.Properties["FechaIntegracion" + j] as string); } else { fechaintegracion = ""; } if (Application.Current.Properties.ContainsKey("FechaSalida" + j)) { fechasalida = (Application.Current.Properties["FechaSalida" + j] as string); } else { fechasalida = ""; } if (Application.Current.Properties.ContainsKey("RazonSalida" + j)) { razonsalida = (Application.Current.Properties["RazonSalida" + j] as string); } else { razonsalida = ""; } if (Application.Current.Properties.ContainsKey("EstatusIntegracion" + j)) { estatusintegracion = (Application.Current.Properties["EstatusIntegracion" + j] as string); } else { estatusintegracion = ""; } Proyects.Add(new Proyecto() //agrega a mi lista todos los elementos existentes en persistencia { EstatusIntegracion = estatusintegracion, FechaIntegracion = fechaintegracion, FechaSalida = fechasalida, NombreProyecto = nombreproyecto, RazonSalida = razonsalida, }); } IsRefreshing = false; HeighListView = 47 * Proyects.Count; //cantidad de filas en mi lista, multiplicado por 44 que es el alto maximo de cada fila }