예제 #1
0
        public ActionResult OstatniCreate(MeetingOstatniEdit meetingOstatniEdit)
        {
            ModelState.Merge(meetingOstatniEdit.Validate(Db));

            if (ModelState.IsValid)
            {
                MeetingCache.Insert(Db, MeetingType.Ostatni, UserId, meetingOstatniEdit);
                return RedirectToAction("OstatniIndex");
            }

            PopulateMeetingTitleTypeId(MeetingType.Ostatni, meetingOstatniEdit.MeetingTitleTypeId);
            PopulateMainLeaderId(meetingOstatniEdit.OrganizerId.GetValueOrDefault(UserId));
            PopulateSecondaryLeaderId(meetingOstatniEdit.SecondaryLeaderId);
            PopulateBankAccountId(BankAccountType.Others, UserId, meetingOstatniEdit.BankAccountId);
            PopulateSecondBankAccountId(BankAccountType.Others, UserId, meetingOstatniEdit.SecondBankAccountId);

            return View(meetingOstatniEdit);
        }
예제 #2
0
        public ActionResult OstatniEdit(MeetingOstatniEdit meetingOstatniEdit)
        {
            ModelState.Merge(meetingOstatniEdit.Validate(Db));

            if (ModelState.IsValid)
            {
                Meeting meeting = meetingOstatniEdit.GetModel(Db, UserId);
                bool success = MeetingCache.Update(Db, ref meeting);
                if (!success)
                {
                    return RedirectToAccessDenied();
                }

                return RedirectToAction("OstatniIndex");
            }

            PopulateMeetingTitleTypeId(MeetingType.Ostatni, meetingOstatniEdit.MeetingTitleTypeId);
            PopulateMainLeaderId(UserId, meetingOstatniEdit.MainLeaderId);
            PopulateSecondaryLeaderId(meetingOstatniEdit.SecondaryLeaderId);
            PopulateSecondaryOrganizerId(meetingOstatniEdit.MainLeaderId, meetingOstatniEdit.SecondaryLeaderId, meetingOstatniEdit.SecondaryOrganizerId);
            PopulateBankAccountId(BankAccountType.Others, UserId, meetingOstatniEdit.BankAccountId);
            PopulateSecondBankAccountId(BankAccountType.Others, UserId, meetingOstatniEdit.SecondBankAccountId);

            return View(meetingOstatniEdit);
        }
예제 #3
0
        public static MeetingOstatniEdit GetModelView(Meeting meeting)
        {
            if (meeting == null || meeting.MeetingType != MeetingType.Ostatni)
                return null;

            var meetingViewOstatni = new MeetingOstatniEdit(meeting);
            return meetingViewOstatni;
        }