Esempio n. 1
0
        public ActionResult Create(Wish wish)
        {
            if (ModelState.IsValid)
            {
                //adding a prefix to the wish string
                //string TheWish = "I wish to " + wish.KidWish;


                service.Add(wish);
                service.Commit();



                // return RedirectToAction("Details" , new { id = wish.WishID});
                return(RedirectToAction("WishesFundRaisedByAFundRaiser"));
            }

            ViewBag.KidID = new SelectList(KidService.GetMany(), "KidID", "KidFistName", wish.KidID);
            return(View(wish));
        }
Esempio n. 2
0
        // POST: api/wishes
        public IHttpActionResult Post(Wish item)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Not a valid model"));
            }

            //if it is not working create  a wish instance
            Wish wish = new Wish()
            {
                WishID = item.WishID,
                //Kid = item.Kid,
                KidID          = item.KidID,
                Desc           = item.Desc,
                ExpirationDate = item.ExpirationDate,
                FundRaised     = item.FundRaised,
                FundToRaise    = item.FundToRaise
            };

            service.Add(wish);
            service.Commit();

            return(Ok());
        }