예제 #1
0
 public Parent(ParentViewModel child)
 {
     PhoneNumber = child.PhoneNumber;
     FullName = child.FullName;
     Id = child.Id;
     Address = child.Address;
     WorkPlace = child.WorkPlace;
     Relatives = child.Relatives;
 }
예제 #2
0
        public ActionResult AddParents(ParentViewModel parent)
        {
            if (ModelState.IsValid)
            {
                Parent worker = new Parent(parent);

                Parent b = db.Parents.Find(parent.Id);
                if (b != null)
                {
                    worker.Id = parent.Id;
                    UpdateModel(b);
                    db.SaveChanges();

                }
                else
                {
                    Child c = db.Children.Find(parent.ChildId);
                    List<Child> s = new List<Child> { c };
                    worker.Childs = s;
                    db.Parents.Add(worker);
                    db.SaveChanges();

                }
                return PartialView("Kostil");
            }
            return PartialView(parent);
        }
예제 #3
0
 public PartialViewResult AddParents()
 {
     ParentViewModel child = new ParentViewModel();
     child.Id = -1;
     return PartialView("AddParents", child);
 }