コード例 #1
0
ファイル: SessionsController.cs プロジェクト: daxko/Usablog
        public ActionResult Create(SessionInputs inputs)
        {
            var session = new Session(inputs.StudyId)
            {
                ScheduledStart = inputs.ScheduledStart,
                Facilitator = inputs.Facilitator,
                RespondentName = inputs.RespondentName,
                RespondentOrganization = inputs.RespondentOrganization,
                RespondentUrl = inputs.RespondentUrl,
                VideoUrl = inputs.VideoUrl,
                Notes = inputs.Notes
            };

            try
            {
                DocumentSession.Store(session);
                DocumentSession.SaveChanges();

                return RedirectToAction("Details", "Studies", new { Id = inputs.StudyId });
            }
            catch
            {
                ViewBag.Study = DocumentSession.Load<Study>(inputs.StudyId);
                return View(session);
            }
        }
コード例 #2
0
ファイル: SessionsController.cs プロジェクト: daxko/Usablog
        public ActionResult Edit(string id, SessionInputs inputs)
        {
            var session = DocumentSession.Include<Session>(s => s.StudyId).Load(id);

            session.ScheduledStart = inputs.ScheduledStart;
            session.Facilitator = inputs.Facilitator;
            session.RespondentName = inputs.RespondentName;
            session.RespondentOrganization = inputs.RespondentOrganization;
            session.RespondentUrl = inputs.RespondentUrl;
            session.VideoUrl = inputs.VideoUrl;
            session.Notes = inputs.Notes;

            try
            {
                DocumentSession.SaveChanges();

                return RedirectToAction("Details", new { Id = id });
            }
            catch
            {
                ViewBag.Study = DocumentSession.Load<Study>(session.StudyId);
                return View(session);
            }
        }