// 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()); }