Exemplo n.º 1
0
        public IActionPlanDto GetActionPlan(int actionPlanID)
        {
            string         command    = "SELECT * FROM actionplan WHERE ActionPlanID='{0}';";
            IActionPlanDto actionPlan = new ActionPlanDto();

            using (MySqlConnection conn = Connection.GetConnection())
            {
                conn.Open();
                MySqlCommand cmd = new MySqlCommand(string.Format(command, actionPlanID.ToString()), conn);

                using MySqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    actionPlan = new ActionPlanDto()
                    {
                        ActionPlanID    = Convert.ToInt32(reader["ActionPlanID"]),
                        AccountID       = Convert.ToInt32(reader["AccountID"]),
                        PlanTitle       = reader["PlanTitle"].ToString(),
                        PlanMessage     = reader["PlanMessage"].ToString(),
                        PlanCategory    = reader["PlanCategory"].ToString(),
                        PlanDateCreated = Convert.ToDateTime(reader["PlanDateCreated"])
                    };
                }
            }
            return(actionPlan);
        }
Exemplo n.º 2
0
        public async Task <ActionPlanDto> GetActionPlanAsync(Guid id, CancellationToken ct)
        {
            ActionPlan ActionPlanEntity = await _uow.ActionPlan.GetActionPlanAsync(id, ct);

            ActionPlanDto ActionPlanDto = _mapper.Mapper.Map <ActionPlanDto>(ActionPlanEntity);

            return(ActionPlanDto);
        }