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); }
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); }
public static MeetingOstatniEdit GetModelView(Meeting meeting) { if (meeting == null || meeting.MeetingType != MeetingType.Ostatni) return null; var meetingViewOstatni = new MeetingOstatniEdit(meeting); return meetingViewOstatni; }