Beispiel #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            FamilyCertificate familyCertificate = db.FamilyCertificates.Find(id);

            db.FamilyCertificates.Remove(familyCertificate);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #2
0
 public ActionResult Edit([Bind(Include = "FamilyCertificatesID,RegistrationDate,ExpirationDate,FamilyMembers,PersonID")] FamilyCertificate familyCertificate)
 {
     if (ModelState.IsValid)
     {
         db.Entry(familyCertificate).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.PersonID = new SelectList(db.People, "PersonID", "PersonalNumber", familyCertificate.PersonID);
     return(View(familyCertificate));
 }
Beispiel #3
0
        // GET: FamilyCertificates/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            FamilyCertificate familyCertificate = db.FamilyCertificates.Find(id);

            if (familyCertificate == null)
            {
                return(HttpNotFound());
            }
            return(View(familyCertificate));
        }
Beispiel #4
0
        // GET: FamilyCertificates/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            FamilyCertificate familyCertificate = db.FamilyCertificates.Find(id);

            if (familyCertificate == null)
            {
                return(HttpNotFound());
            }
            ViewBag.PersonID = new SelectList(db.People, "PersonID", "PersonalNumber", familyCertificate.PersonID);
            return(View(familyCertificate));
        }
Beispiel #5
0
        // GET: FamilyCertificates/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            FamilyCertificate familyCertificate = db.FamilyCertificates.Find(id);

            string[] strArray = familyCertificate.FamilyMembers.Split(',');
            //FamilyCertificate.FamilyMembers = new List<Person>();
            familyCertificate.FamilyMembers = "";
            foreach (var item in strArray)
            {
                int i = 0;
                foreach (Person person in db.People)
                {
                    if (person.PersonalNumber == item)
                    {
                        familyCertificate.FamilyMembers += $"{person.FirstName}  {person.LastName}       ";
                        //FamilyCertificate.FamilyMembers.Add(person);
                        i++;
                    }
                }

                if (i == 0)
                {
                    MessageBox.Show(item + " Ky Numer Personal nuk ekziston");
                    //throw new Exception(item + " Ky Numer Personal nuk ekziston");
                }
            }

            if (familyCertificate == null)
            {
                return(HttpNotFound());
            }
            return(View(familyCertificate));
        }