public ActionResult DeleteConfirmed(int id)
        {
            LostPerson lostPerson = db.LostPerson.Find(id);

            db.LostPerson.Remove(lostPerson);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #2
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            LostPerson lostPerson = await db.LostPersons.FindAsync(id);

            db.LostPersons.Remove(lostPerson);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "IdPerson,name,lastname,BDate,Photo,Describe,Gender,LostDate,LostPlace")] LostPerson lostPerson)
 {
     if (ModelState.IsValid)
     {
         db.Entry(lostPerson).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Gender = new SelectList(db.Gender, "Id", "Name", lostPerson.Gender);
     return(View(lostPerson));
 }
Beispiel #4
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,Name,Surname,Age,Gender,Description")] LostPerson lostPerson)
        {
            if (ModelState.IsValid)
            {
                db.Entry(lostPerson).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(lostPerson));
        }
Beispiel #5
0
        public async Task <ActionResult> Create([Bind(Include = "Id,Name,Surname,Age,Gender,Description")] LostPerson lostPerson)
        {
            if (ModelState.IsValid)
            {
                db.LostPersons.Add(lostPerson);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(lostPerson));
        }
        // GET: LostPersons/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LostPerson lostPerson = db.LostPerson.Find(id);

            if (lostPerson == null)
            {
                return(HttpNotFound());
            }
            return(View(lostPerson));
        }
Beispiel #7
0
        // GET: LostPeople/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LostPerson lostPerson = await db.LostPersons.FindAsync(id);

            if (lostPerson == null)
            {
                return(HttpNotFound());
            }
            return(View(lostPerson));
        }
        // GET: LostPersons/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LostPerson lostPerson = db.LostPerson.Find(id);

            if (lostPerson == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Gender = new SelectList(db.Gender, "Id", "Name", lostPerson.Gender);
            return(View(lostPerson));
        }