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); } }
public async Task <VoteRes> SaveVote(SaveVote request) { return(await voteRepository.SaveVote(request)); }
public JsonResult SaveVote(SaveVote request) { var result = ApiHelper <VoteRes> .HttpPostAsync($"Post/Vote", "POST", request); return(Json(new { data = result })); }
public async Task <OkObjectResult> Vote(SaveVote model) { var result = await voteServices.SaveVote(model); return(Ok(result)); }