// GET: Birthday/Delete/5
        public ActionResult Delete(int id)
        {
            BirthdayTrackerDataAccess _birthdayTrackerDataAccess = new BirthdayTrackerDataAccess();

            _birthdayTrackerDataAccess.DeleteBirthday(id);

            TempData["Message"] = "Birthday Deleted!!!";

            return(RedirectToAction("Index"));
        }
        // GET: Birthday/Edit/5
        public ActionResult Edit(int id)
        {
            BirthdayTrackerDataAccess _birthdayTrackerDataAccess = new BirthdayTrackerDataAccess();

            var birthday       = _birthdayTrackerDataAccess.GetSingleSavedBirthday(id);
            var mappedBirthday = new BirthdayInputViewModel();

            mappedBirthday.BirthdayId = birthday.BirthdayId;
            mappedBirthday.FirstName  = birthday.FirstName;
            mappedBirthday.LastName   = birthday.LastName;
            mappedBirthday.BirthDay   = birthday.ConvertedDateTime.Day;
            mappedBirthday.BirthMonth = birthday.ConvertedDateTime.Month;
            mappedBirthday.BirthYear  = birthday.ConvertedDateTime.Year;


            return(View(mappedBirthday));
        }
        public ActionResult Edit(int id, BirthdayInputViewModel birthdayInput)
        {
            BirthdayTrackerDataAccess _birthdayTrackerDataAccess = new BirthdayTrackerDataAccess();

            try
            {
                var mappedBirthday = new Birthday();
                mappedBirthday.FirstName         = birthdayInput.FirstName;
                mappedBirthday.LastName          = birthdayInput.LastName;
                mappedBirthday.ConvertedDateTime = new DateTime(birthdayInput.BirthYear, birthdayInput.BirthMonth, birthdayInput.BirthDay);

                _birthdayTrackerDataAccess.UpdateBirthday(mappedBirthday, id);

                TempData["Message"] = "Birthday Updated!!!";

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult Create(BirthdayInputViewModel birthdayInput)
        {
            BirthdayTrackerDataAccess _birthdayTrackerDataAccess = new BirthdayTrackerDataAccess();

            try
            {
                var birthday = new Birthday();
                birthday.FirstName         = birthdayInput.FirstName;
                birthday.LastName          = birthdayInput.LastName;
                birthday.ConvertedDateTime = new DateTime(birthdayInput.BirthYear, birthdayInput.BirthMonth, birthdayInput.BirthDay);

                _birthdayTrackerDataAccess.SaveBirthday(birthday);

                TempData["Message"] = "Birthday Saved!!!";

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
        // GET: Birthday
        public ActionResult Index(
            )
        {
            BirthdayTrackerDataAccess _birthdayTrackerDataAccess = new BirthdayTrackerDataAccess();

            var birthdayList       = _birthdayTrackerDataAccess.GetSavedBirthdays();
            var mappedBirthdayList = new List <BirthdayDisplayViewModel>();

            foreach (var b in birthdayList)
            {
                var mappedBirthday = new BirthdayDisplayViewModel();
                mappedBirthday.BirthdayId = b.BirthdayId;
                mappedBirthday.FirstName  = b.FirstName;
                mappedBirthday.LastName   = b.LastName;
                mappedBirthday.Birthday   = b.ConvertedDateTime;


                mappedBirthdayList.Add(mappedBirthday);
            }

            return(View(mappedBirthdayList));
        }