Beispiel #1
0
        public ActionResult Create([Bind(Include = "DonorId,FName,Init,LName,Title,Suffix,Email,Cell,Birthday,Gender,MarkerId,ContactId,CompanyName,Address,City,State,Zipcode,Phone")] DONOR donor)
        {
            if (ModelState.IsValid)
            {
                DONOR myDonor = donor;
                if (myDonor.FName == null && myDonor.LName == null)
                {
                    myDonor.FName = myDonor.CompanyName;
                }
                drRepo.Add(donor);
                return(RedirectToAction("Index"));
            }

            ViewBag.CONTACTID = new SelectList(ddlData.CONTACT, "CONTACTID", "TYPEOF", donor.ContactId);
            ViewBag.MARKERID  = new SelectList(ddlData.IDENTITYMARKER, "MARKERID", "MARKERTYPE", donor.MarkerId);
            ViewBag.Gender    = new SelectList(ddlData.DONOR, "Gender", "Gender");
            return(View(donor));
        }
Beispiel #2
0
        public int AddDonor(string name, string address, string phoneNumber)
        {
            Donor donor = new Donor(0, name, address, phoneNumber);

            return(_donorRepository.Add(donor));
        }