Example #1
0
        public IActionResult Create(DonationModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            var entity = new Donation();

            entity.Description = model.Description;
            entity.Campaign    = campaigns.GetById(model.CampaignId);
            entity.Id          = donations.Count() + 1;
            donations.Add(entity);
            return(RedirectToAction("Index"));
        }