public ActionResult SetkaniTymuCreate(MeetingSetkaniTymuEdit meetingSetkaniTymuEdit) { ModelState.Merge(meetingSetkaniTymuEdit.Validate(Db)); if (ModelState.IsValid) { MeetingCache.Insert(Db, MeetingType.SetkaniTymu, UserId, meetingSetkaniTymuEdit); return RedirectToAction("SetkaniTymuIndex"); } PopulateMeetingTitleTypeId(MeetingType.SetkaniTymu, meetingSetkaniTymuEdit.MeetingTitleTypeId); PopulateMainLeaderId(meetingSetkaniTymuEdit.OrganizerId.GetValueOrDefault(UserId)); PopulateSecondaryLeaderId(meetingSetkaniTymuEdit.SecondaryLeaderId); PopulateBankAccountId(BankAccountType.TeamMeeting, UserId, meetingSetkaniTymuEdit.BankAccountId); PopulateSecondBankAccountId(BankAccountType.TeamMeeting, UserId, meetingSetkaniTymuEdit.SecondBankAccountId); return View(meetingSetkaniTymuEdit); }
public ActionResult SetkaniTymuEdit(MeetingSetkaniTymuEdit meetingSetkaniTymuEdit) { ModelState.Merge(meetingSetkaniTymuEdit.Validate(Db)); if (ModelState.IsValid) { Meeting meeting = meetingSetkaniTymuEdit.GetModel(UserId); bool success = MeetingCache.Update(Db, ref meeting); if (!success) { return RedirectToAccessDenied(); } return RedirectToAction("SetkaniTymuIndex"); } PopulateMeetingTitleTypeId(MeetingType.SetkaniTymu, meetingSetkaniTymuEdit.MeetingTitleTypeId); PopulateMainLeaderId(UserId, meetingSetkaniTymuEdit.MainLeaderId); PopulateSecondaryLeaderId(meetingSetkaniTymuEdit.SecondaryLeaderId); PopulateSecondaryOrganizerId(meetingSetkaniTymuEdit.MainLeaderId, meetingSetkaniTymuEdit.SecondaryLeaderId, meetingSetkaniTymuEdit.SecondaryOrganizerId); PopulateBankAccountId(BankAccountType.TeamMeeting, UserId, meetingSetkaniTymuEdit.BankAccountId); PopulateSecondBankAccountId(BankAccountType.TeamMeeting, UserId, meetingSetkaniTymuEdit.SecondBankAccountId); return View(meetingSetkaniTymuEdit); }
public static MeetingSetkaniTymuEdit GetModelView(Meeting meeting) { if (meeting == null || meeting.MeetingType != MeetingType.SetkaniTymu) return null; var meetingViewSetkaniTymu = new MeetingSetkaniTymuEdit(meeting); return meetingViewSetkaniTymu; }