예제 #1
0
        public EmailModel GetVariableConfigration(int workFlowId)
        {
            var emailModel  = new EmailModel();
            var emailconfig = workFlowRepository.GetMasterWorkFlowById(workFlowId).Result;

            foreach (var wkVariable in emailconfig.WorkFlowVariable)
            {
                switch (wkVariable.Name.ToUpper())
                {
                case "HOST":
                    emailModel.Host = wkVariable.Value;
                    break;

                case "PORT":
                    emailModel.Port = Convert.ToInt32(wkVariable.Value);
                    break;

                case "FROM":
                    emailModel.FromEmail = wkVariable.Value;
                    break;

                case "TO":
                    emailModel.ToEmail = wkVariable.Value;
                    break;

                case "BODY":
                    emailModel.Body = wkVariable.Value;
                    break;

                case "SUBJECT":
                    emailModel.Subject = wkVariable.Value;
                    break;

                case "PASSWORD":
                    emailModel.Password = wkVariable.Value;
                    break;
                }
            }

            return(emailModel);
        }
        public async Task <IActionResult> GetWorkFlowById(int workflowId)
        {
            if (workflowId == null)
            {
                return(BadRequest());
            }
            try
            {
                var workFlow = _mapper.Map <WorkflowViewModel>(await workFlowRepository.GetMasterWorkFlowById(workflowId));
                if (workFlow == null)
                {
                    return(NotFound());
                }

                return(Ok(workFlow));
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }