Beispiel #1
0
        public ActionResult Edit(int id)
        {
            FamilyBusinessLayer familyBusinessLayer = new FamilyBusinessLayer();
            FamilyMember        fm = familyBusinessLayer.FamilyMembers.Single(fam => fam.id == id);

            return(View(fm));
        }
Beispiel #2
0
        public ActionResult Edit(FamilyMember fmes)
        {
            if (ModelState.IsValid)
            {
                FamilyBusinessLayer familyBusinessLayer = new FamilyBusinessLayer();
                familyBusinessLayer.EditFamily(fmes);

                return(RedirectToAction("Index"));
            }
            return(View());
        }
Beispiel #3
0
        public ActionResult Delete(int id)
        {
            if (ModelState.IsValid)
            {
                FamilyBusinessLayer familyBusinessLayer = new FamilyBusinessLayer();
                familyBusinessLayer.DeleteFamily(id);
                return(RedirectToAction("Index"));
            }

            return(View());
        }
Beispiel #4
0
        public ActionResult Create_Post()
        {
            //FamilyMember fm = new FamilyMember();
            //fm.Name = Name;
            //fm.Gender = Gender;
            //fm.City = City;
            //fm.Mobileno = Mobileno;
            //fm.DateoOfBirth = Convert.ToDateTime(DateOfBirth);
            if (ModelState.IsValid)
            {
                FamilyMember fm = new FamilyMember();
                UpdateModel(fm);
                FamilyBusinessLayer familyBusinessLayer = new FamilyBusinessLayer();
                familyBusinessLayer.AddFamilyMember(fm);

                return(RedirectToAction("Index"));
            }
            return(View());
        }
Beispiel #5
0
        public ActionResult Index()
        {
            FamilyBusinessLayer family = new FamilyBusinessLayer();
            List <FamilyMember> fmb    = family.FamilyMembers.ToList();

            //FamilyBusinessLayer familyBusinessLayer = new FamilyBusinessLayer();
            //List<FamilyMember> familyMembers = new List<FamilyMember>();

            return(View(fmb));

            //if (searchBy == "Gender")
            //{
            //    return View(family.FamilyMembers.Where(x => x.Gender == search || search == null).ToList());
            //}
            //else
            //{
            //    return View(family.FamilyMembers.Where(x => x.Name.StartsWith(search) || search == null).ToList());
            //}
        }