// GET: Cities/Create public ActionResult Create() { var Department = ComboxHelper.GetDepartment(); ViewBag.DepartmentId = new SelectList(Department, "DepartmentId", "Name"); return(View()); }
public async Task <ActionResult> Edit([Bind(Include = "CiudadId,Nombre,DepartamentoId,Estatus")] Ciudad ciudad) { if (ModelState.IsValid) { db.Entry(ciudad).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.DepartamentoId = new SelectList(ComboxHelper.GetDepartamentos(), "DepartamentoId", "Nombre", ciudad.DepartamentoId); return(View(ciudad)); }
public async Task <ActionResult> Create([Bind(Include = "CiudadId,Nombre,DepartamentoId,Estatus")] Ciudad ciudad) { if (ModelState.IsValid) { db.Ciudads.Add(ciudad); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.DepartamentoId = new SelectList(ComboxHelper.GetDepartamentos(), "DepartamentoId", "Nombre"); return(View(ciudad)); }
public ActionResult Edit([Bind(Include = "CityId,Name,DepartmentId")] City city) { if (ModelState.IsValid) { db.Entry(city).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } var Department = ComboxHelper.GetDepartment(); ViewBag.DepartmentId = new SelectList(Department, "DepartmentId", "Name"); return(View(city)); }
// GET: Ciudades/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Ciudad ciudad = await db.Ciudads.FindAsync(id); if (ciudad == null) { return(HttpNotFound()); } ViewBag.DepartamentoId = new SelectList(ComboxHelper.GetDepartamentos(), "DepartamentoId", "Nombre"); return(View(ciudad)); }
public ActionResult Create([Bind(Include = "CityId,Name,DepartmentId")] City city) { if (ModelState.IsValid) { db.Cities.Add(city); db.SaveChanges(); return(RedirectToAction("Index")); } var Department = ComboxHelper.GetDepartment(); ViewBag.DepartmentId = new SelectList(Department, "DepartmentId", "Name"); return(View(city)); }
// GET: Cities/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } City city = db.Cities.Find(id); if (city == null) { return(HttpNotFound()); } var Department = ComboxHelper.GetDepartment(); ViewBag.DepartmentId = new SelectList(Department, "DepartmentId", "Name"); return(View(city)); }
// GET: Ciudades/Create public ActionResult Create() { ViewBag.DepartamentoId = new SelectList(ComboxHelper.GetDepartamentos(), "DepartamentoId", "Nombre"); return(View()); }