예제 #1
0
        public ActionResult Save(Donation donation, int donorId)
        {
            if (!Session.IsSignedIn())
            {
                return(Json(new { saved = false }));
            }

            if (!donationService.IsValidDonation(donation, out var cause))
            {
                return(Json(new { saved = false, cause = cause }));
            }
            else
            {
                var saved = donationService.CreateDonation(donation);

                return(Json(new { saved }));
            }
        }