//private GestionMVCContext db = new GestionMVCContext(); // GET: Personas public ActionResult Index() { List <Persona> personasList; personasList = PersonasService.GetAll(); return(View(personasList)); }
private void btnPersonasGetInactivos_Click(object sender, EventArgs e) { List <Persona> personasList; personasList = PersonasService.GetInActivos(); dgvPersonas.DataSource = personasList; }
public IHttpActionResult Insert(Persona requestDTO) { IHttpActionResult respuesta; ResponseDTO responseDTO = new ResponseDTO(); int intNewId; string strErrores = ""; //intNewId = PersonasService.Insert(newPersona); //intNewId = PersonasService.InsertScalar(newPersona); intNewId = PersonasService.InsertValid(requestDTO, out strErrores); if (intNewId > 0) { responseDTO.NewId = intNewId; respuesta = Ok(responseDTO); } else { responseDTO.NewId = 0; responseDTO.Errores = strErrores; respuesta = Ok(responseDTO); } return(respuesta); }
protected void btnRefresh_Click(object sender, EventArgs e) { List<Persona> personasList; personasList = PersonasService.GetAll(); repPersonas.DataSource = personasList; repPersonas.DataBind(); }
public IHttpActionResult GetInActivos() { IHttpActionResult respuesta; List <Persona> personasList; personasList = PersonasService.GetInActivos(); respuesta = Ok(personasList); return(respuesta); }
public PersonaServiceTest() { db = ContextBuilder.GetUniqueInMemory().Result; mockScrapping = new Mock <IPersonaScrappingService>(); mockPrincipal = new Mock <IPrincipal>(); mockPrincipal.Setup(p => p.Identity.Name).Returns(TestingUser); Service = new PersonasService(db, mockScrapping.Object, mockPrincipal.Object); }
private void Button_Click(object sender, RoutedEventArgs e) { var watch = new Stopwatch(); watch.Start(); var tarea = Task.Run(() => PersonasService.GetPersonas()); var list = tarea.Result; watch.Stop(); }
public IHttpActionResult GetAll() { IHttpActionResult respuesta; List <Persona> personasList; List <PersonaDTO> personasDTOList; personasList = PersonasService.GetAll(); personasDTOList = PersonasMapper.ToDTOList(personasList); respuesta = Ok(personasDTOList); return(respuesta); }
// GET: Personas/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Persona persona = PersonasService.GetById(id.GetValueOrDefault()); if (persona == null) { return(HttpNotFound()); } return(View(persona)); }
public IHttpActionResult GetById(int id) { IHttpActionResult respuesta; Persona oPersona; oPersona = PersonasService.GetById(id); if (oPersona != null) { respuesta = Ok(oPersona); } else { respuesta = NotFound(); } return(respuesta); }
protected void btnInsertar_Click(object sender, EventArgs e) { Persona newPersona; int intNewId; string strErrores = ""; newPersona = new Persona(); newPersona.Nombre = txtNombre.Text; newPersona.Email = txtEmail.Text; newPersona.Activo = chkActivo.Checked; //intNewId = PersonasService.Insert(newPersona); //intNewId = PersonasService.InsertScalar(newPersona); intNewId = PersonasService.InsertValid(newPersona, out strErrores); if (intNewId > 0) { litOutput.Text = "Se inserto el ID:" + intNewId.ToString(); } else { litOutput.Text = "Errores: " + strErrores; } }
public ActionResult Create([Bind(Include = "Id,Nombre,Email,Activo")] Persona persona) { int intNewId; string strErrores = ""; if (ModelState.IsValid) { intNewId = PersonasService.InsertValid(persona, out strErrores); if (intNewId > 0) { return(RedirectToAction("Index")); } else { ViewBag.Errores = strErrores; return(View(persona)); } } return(View(persona)); }
private void btnInsert_Click(object sender, EventArgs e) { Persona newPersona; int intNewId; string strErrores = ""; newPersona = new Persona(); newPersona.Nombre = txtNombre.Text; newPersona.Email = txtEmail.Text; newPersona.Activo = chkActivo.Checked; //intNewId = PersonasService.Insert(newPersona); //intNewId = PersonasService.InsertScalar(newPersona); intNewId = PersonasService.InsertValid(newPersona, out strErrores); if (intNewId > 0) { MessageBox.Show("Se inserto el ID:" + intNewId.ToString()); } else { MessageBox.Show("Errores: " + strErrores); } }
private void btnGetById_Click(object sender, EventArgs e) { Persona oPersona; int intId; if (int.TryParse(txtPersonaId.Text, out intId)) { oPersona = PersonasService.GetById(intId); if (oPersona != null) { txtPersonaOutput.Text = oPersona.ToString(); } else { txtPersonaOutput.Text = "No se encontro la Persona"; } } else { txtPersonaOutput.Text = "-ERROR-"; } }