示例#1
0
        public async Task <VoteRes> SaveVote(SaveVote request)
        {
            var result = new VoteRes()
            {
                VoteId  = 0,
                Message = "Something went wrong, please contact administrator."
            };

            try
            {
                DynamicParameters parameters = new DynamicParameters();
                parameters.Add("@RateId", request.VoteId);
                parameters.Add("@GameId", request.GameId);
                parameters.Add("@Vote", request.vote);
                parameters.Add("@UserId", request.UserId);
                result = await SqlMapper.QueryFirstOrDefaultAsync <VoteRes>(cnn : connection,
                                                                            sql : "sp_SaveRate",
                                                                            param : parameters,
                                                                            commandType : CommandType.StoredProcedure);

                return(result);
            }
            catch (Exception ex)
            {
                return(result);
            }
        }
示例#2
0
 public async Task <VoteRes> SaveVote(SaveVote request)
 {
     return(await voteRepository.SaveVote(request));
 }
示例#3
0
        public JsonResult SaveVote(SaveVote request)
        {
            var result = ApiHelper <VoteRes> .HttpPostAsync($"Post/Vote", "POST", request);

            return(Json(new { data = result }));
        }
示例#4
0
        public async Task <OkObjectResult> Vote(SaveVote model)
        {
            var result = await voteServices.SaveVote(model);

            return(Ok(result));
        }