Beispiel #1
0
        public bool IsSelectionAllowed(NeedsCommunion needsCommunion)
        {
            if (needsCommunion == null)
            {
                return(true);
            }

            // if year or day != today's date then return true
            return(needsCommunion.Timestamp.Year != DateTime.Today.Year ||
                   needsCommunion.Timestamp.DayOfYear != DateTime.Today.DayOfYear);
        }
Beispiel #2
0
        public ActionResult Edit(NeedsCommunionViewModel viewModel)
        {
            if (!viewModel.NeedsCommunion)
            {
                return(Redirect(viewModel.ReturnUrl));
            }
            var needsCommunion = new NeedsCommunion
            {
                MemberId  = viewModel.MemberId,
                Timestamp = DateTime.Now
            };

            unitOfWork.NeedsCommunionRepository.Add(needsCommunion);

            return(Redirect(viewModel.ReturnUrl));
        }