Example #1
0
        public CreateClientOut CreateClient(CreateClientIn input)
        {
            CreateClientOut response = new CreateClientOut()
            {
                ResponseCode = Entities.Client.General.ResponseCode.Error
            };

            using (IDbConnection connection = new SqlConnection(connectionString))
            {
                connection.Open();
                DynamicParameters param = new DynamicParameters();

                param.Add("@ClientId", input.client.ClientId);
                param.Add("@FirstName", input.client.FirstName);
                param.Add("@LastName", input.client.LastName);
                param.Add("@Age", input.client.Age);
                param.Add("@Identification", input.client.Identification);
                param.Add("@Email", input.client.Email);
                param.Add("@Operation", 1);
                param.Add("@RESULT", dbType: DbType.Int32, direction: ParameterDirection.ReturnValue);


                var data = connection.Execute("SP_Crud_Client", param, commandType: CommandType.StoredProcedure);

                if (param.Get <int>("@RESULT") == 1)
                {
                    response.ResponseCode = Entities.Client.General.ResponseCode.Success;
                }
            }

            return(response);
        }
        public IHttpActionResult CreateClient(CreateClientIn input)
        {
            var response = client.CreateClient(input);

            return(Ok(response));
        }
Example #3
0
 public CreateClientOut CreateClient(CreateClientIn input)
 {
     return(clientDA.CreateClient(input));
 }