// POST: api/donations public IHttpActionResult Post(Donation item) { if (!ModelState.IsValid) { return(BadRequest("Not a valid model")); } //if it is not working create a wish instance Donation donation = new Donation() { //ID = item.ID, Date = item.Date, Sum = item.Sum, UserId = User.Identity.GetUserId(), WishId = item.WishId, }; service.Add(donation); service.Commit(); //update the wish Wish wish = wishService.GetById(item.WishId); wish.FundRaised += item.Sum; wishService.Update(wish); wishService.Commit(); return(Ok()); }
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)); }
// 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()); }