示例#1
0
        public ActionResult Create(CreateTaskDefinitionEditModel editModel)
        {
            if (editModel.IsValid() == false)
            {
                Response.StatusCode = 500;
                return(PartialView("_ValidationErrorSummary", new ValidationErrorSummaryViewModel(editModel.GetValidationErrors())));
            }

            TaskDefinitionListItemViewModel viewModel = _taskDefinitionService.Create(editModel);

            return(PartialView("_TaskDefinitionTableRow", viewModel));
        }
示例#2
0
        public TaskDefinitionListItemViewModel Create(CreateTaskDefinitionEditModel editModel)
        {
            TaskDefinition definition = new TaskDefinition
            {
                SystemName   = editModel.Title,
                RoleType     = (RoleTypeEnum)Enum.Parse(typeof(RoleTypeEnum), editModel.RoleType),
                SystemNameEN = editModel.TitleEN
            };

            _taskDefinitionDAO.Store(definition);

            TaskDefinitionListItemViewModel viewModel = new TaskDefinitionListItemViewModel
            {
                Id           = definition.Id,
                SystemName   = definition.SystemName,
                RoleType     = definition.RoleType.ToString(),
                SystemNameEN = definition.SystemNameEN
            };

            return(viewModel);
        }