public ActionResult createkid(KidModel collection)
        {
            var    userId = (int)Session["idu"];
            String nom    = ps.GetById(userId).nom;
            String prenom = ps.GetById(userId).prenom;
            String mail   = ps.GetById(userId).email;

            ViewBag.home   = mail;
            ViewBag.nom    = nom;
            ViewBag.prenom = prenom;

            IKidService sc = new KidService();
            Kid         c  = new Kid();

            if (ModelState.IsValid)
            {
                c.idParent  = (int)Session["idu"];
                c.FirstName = collection.FirstName;
                c.LastName  = collection.LastName;
                c.Age       = collection.Age;
                c.IsCheked  = false;


                sc.Add(c);
                sc.Commit();


                return(RedirectToAction("Profil"));
            }
            else
            {
                return(View());
            }
        }
示例#2
0
        public ActionResult MyWallet(string id)
        {
            givedbEntities ent       = new givedbEntities();
            Int32          kidid     = Convert.ToInt32(id);
            KidModel       model     = new KidModel();
            var            kidentity = ent.KidBalances.Where(x => x.Id == kidid).FirstOrDefault();

            if (kidentity != null)
            {
                model.kidid     = kidid;
                model.balance   = kidentity.Balance;
                ViewBag.balance = kidentity.Balance.ToString();
                ViewBag.id      = id;
            }
            return(View(model));
        }
示例#3
0
 public ActionResult Kid(KidModel kid)
 {
     if (!ModelState.IsValid)
     {
         ViewBag.ClientKids = _kid.Read(null);
         return(View(kid));
     }
     _kid.CreateOrUpdate(new KidBindingModel
     {
         ClientId = Program.Client.Id,
         KidName  = kid.KidName,
         Height   = kid.Height,
         Free     = kid.Free,
         Age      = kid.Age,
         Gender   = kid.Gender
     });
     ModelState.AddModelError("", "Вы успешно добавили питомца");
     return(RedirectToAction("ProfileKid"));
 }