Ejemplo n.º 1
0
        public async Task <Response> Save(SaveVoteReq request)
        {
            var result = new Response()
            {
                Id      = 0,
                Message = "Something went wrong, please contact administrator."
            };

            try
            {
                DynamicParameters parameters = new DynamicParameters();
                parameters.Add("@Id", request.Id);
                parameters.Add("@Vote", request.Vote);
                parameters.Add("@ProductId", request.ProductId);
                parameters.Add("@UserId", request.UserId);
                result = await SqlMapper.QueryFirstOrDefaultAsync <Response>(cnn : connection, sql : "sp_SaveVote", param : parameters, commandType : CommandType.StoredProcedure);

                return(result);
            }
            catch (Exception ex)
            {
                return(result);
            }
        }
Ejemplo n.º 2
0
        public async Task <OkObjectResult> Save(SaveVoteReq request)
        {
            var result = await voteService.Save(request);

            return(Ok(result));
        }
Ejemplo n.º 3
0
 public async Task <Response> Save(SaveVoteReq request)
 {
     return(await voteRepository.Save(request));
 }