Exemple #1
0
        // GET: Cities/Create
        public ActionResult Create()
        {
            var Department = ComboxHelper.GetDepartment();

            ViewBag.DepartmentId = new SelectList(Department, "DepartmentId", "Name");
            return(View());
        }
Exemple #2
0
        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));
        }
Exemple #3
0
        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));
        }
Exemple #4
0
        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));
        }
Exemple #5
0
        // 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));
        }
Exemple #6
0
        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));
        }
Exemple #7
0
        // 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));
        }
Exemple #8
0
 // GET: Ciudades/Create
 public ActionResult Create()
 {
     ViewBag.DepartamentoId = new SelectList(ComboxHelper.GetDepartamentos(), "DepartamentoId", "Nombre");
     return(View());
 }