Inheritance: PD_TransitionViewModel
コード例 #1
0
        public ActionResult _EditReceiveTransition(PD_ReceiveTransition_ViewModel model)
        {
            var _p = _db.PD_Processes.Find(model.PD_Process_Id);
            if (User.Identity.Name.Equals(_p.LockedBy))
            {
                var transition = _db.PD_ReceiveTransitions.Find(model.PD_Process_Id, model.PD_Subject_Id, model.Id);

                transition.Message = Int32.Parse(model.SelectedMessage);

                _db.SaveChanges();

                return RedirectToAction("ViewSubject", new { processid = model.PD_Process_Id, subjectid = model.PD_Subject_Id, edit = 1 });
            }
            else
            {
                return null;
            }
        }
コード例 #2
0
        public ActionResult _EditReceiveTransition(int processid, int subjectid, int transitionid, int edit)
        {
            var transition = _db.PD_ReceiveTransitions.Find(processid, subjectid, transitionid);
            PD_ReceiveTransition_ViewModel Model = new PD_ReceiveTransition_ViewModel() { PD_Process_Id = transition.PD_Process_Id, PD_Subject_Id = transition.PD_Subject_Id, Id = transition.Id };

            if (transition.Message != null)
            {
                Model.SelectedMessage = "" + transition.Message;
            }

            var messages = _db.PD_Messages.Where(result => result.PD_Process_Id == processid && result.To == subjectid);
            foreach (var message in messages)
            {
                var from = _db.PD_Subjects.Find(processid, message.From);
                Model.AvailableMessages.Add(new SelectListItem() { Value = "" + message.Id, Text = from.Name + "|" + message.PD_MessageType.Name });
            }
            try
            {
                Model.AvailableMessages.Find(result => result.Value == Model.SelectedMessage).Selected = true;
            }
            catch (Exception e) { }


            ViewBag.Edit = edit;
            return PartialView(Model);
        }