Ejemplo n.º 1
0
 public ActionResult Children(Child child)
 {
     return View();
 }
Ejemplo n.º 2
0
        public ActionResult AddChild(ChildViewModel ChildView)
        {
            if (ModelState.IsValid)
            {
                Child worker = new Child(ChildView);

                Child b = db.Children.Find(ChildView.Id);
                if (b != null)
                {
                    worker.Id = ChildView.Id;
                    UpdateModel(b);
                    db.SaveChanges();

                }
                else
                {
                    db.Children.Add(worker);
                    db.SaveChanges();

                }
                return PartialView("Kostil");
            }

            return PartialView(ChildView);
        }
Ejemplo n.º 3
0
        public ActionResult AddMyChild(ChildViewModel ChildView)
        {
            if (ModelState.IsValid)
            {

                Child worker = new Child(ChildView);

                Child b = db.Children.Find(ChildView.Id);
                if (b != null)
                {
                    worker.Id = ChildView.Id;
                    UpdateModel(b);
                    db.SaveChanges();

                }
                else
                {
                    Parent p = db.Parents.Find(ChildView.UserName);
                    List<Parent> s = new List<Parent>() { p };
                    worker.Parents = s;
                    db.Children.Add(worker);
                    db.SaveChanges();

                }
                return RedirectToAction("MyChild", new { name = db.Users.Where(x => x.ParentId == ChildView.UserName).FirstOrDefault().UserName });
            }

            return PartialView("MyChildPartial");
        }