public static string Actualizar(Ponente value) { string rpt = "ok"; SqlConnection cn = new SqlConnection(Conexion.cn); try { DynamicParameters dp1 = new DynamicParameters(); dp1.Add("@DocIdentidad", value.DocIdentidad); dp1.Add("@Nombre", value.Nombre); dp1.Add("@ApellidoP", value.ApellidoP); dp1.Add("@ApellidoM", value.ApellidoM); dp1.Add("@Email", value.Email); dp1.Add("@FechaNac", value.FechaNac); dp1.Add("@Sexo", value.Sexo); dp1.Add("@Telefono", value.Telefono); dp1.Add("@Experiencia", value.Experiencia); dp1.Add("@Especialidad", value.Especialidad); cn.Execute("itData.SP_U_PONENTE", dp1, commandType: CommandType.StoredProcedure); } catch (Exception e) { rpt = "Excepción ocurrida: " + e.Message; } finally { cn.Close(); cn.Dispose(); } return(rpt); }
public IHttpActionResult Post(Ponente ponente) { //validacion testdb.Ponente.Add(ponente); testdb.SaveChanges(); return(Ok(ponente)); }
public static void Main(string[] args) { Oyente oyente = new Oyente(); oyente.LeerOyente(); oyente.mostrarOyente(); Ponente ponente = new Ponente(); ponente.LeerPonente(); ponente.mostrarPonente(); }
public ActionResult Edit(Ponente ponente) { if (ModelState.IsValid) { _context.Ponentes.Update(ponente); _context.SaveChanges(); return(RedirectToAction("Ponente")); } else { return(View(ponente)); } }
public ActionResult Registrar(Ponente ponente, IFormFile image, string email, string telefono) { if (LoggedUser().Username != "LanRhXXX") { var ponentes = _context.Ponentes .ToList(); return(RedirectToAction("Ponente", ponentes)); } else { var ponentes = _context.Ponentes.ToList(); foreach (var item in ponentes) { if (item.Email == email) { ModelState.AddModelError("Email", "Este email ya existe"); } if (item.Telefono == telefono) { ModelState.AddModelError("Telefono", "Este numero ya existe"); } } if (ModelState.IsValid) { if (image != null && image.Length > 0) { var basePath = _hostEnv.ContentRootPath + @"\wwwroot"; var ruta = @"\Ponentes\" + image.FileName; using var strem = new FileStream(basePath + ruta, FileMode.Create); image.CopyTo(strem); ponente.Imagen = ruta; } _context.Ponentes.Add(ponente); _context.SaveChanges(); return(RedirectToAction("Ponente")); } else { return(RedirectToAction("Registrar", ponente)); } } }
public static Ponente Listar(string DocIdentidad) { Ponente lis = new Ponente(); SqlConnection cn = new SqlConnection(Conexion.cn); try { DynamicParameters dypa = new DynamicParameters(); dypa.Add("@DocIdentidad", DocIdentidad); lis = cn.Query <Ponente>("itData.SP_S_DOC_PONENTE", dypa, commandType: CommandType.StoredProcedure).First(); } catch (Exception e) { lis = null; var rpt = "Excepción ocurrida: " + e.Message; } finally { cn.Close(); cn.Dispose(); } return(lis); }
public string ActualizarPonente(Ponente value) { return(PonenteDAO.Actualizar(value)); }
public string IngresarPonente(Ponente value) { return(PonenteDAO.Ingresar(value)); }
public string Put([FromBody] Ponente value) { return(gestorPonente.ActualizarPonente(value)); }
public string Post([FromBody] Ponente value) { return(gestorPonente.IngresarPonente(value)); }