コード例 #1
0
 public IActionResult AddTournamentBetTypes([FromBody] TournamentBetType tournamentBetType)
 {
     try
     {
         if (tournamentBetType == null)
         {
             return(StatusCode(400, StatusCodes.ReturnStatusObject("No items have been provided.")));
         }
         var result = _betTypeRepository.AddTournamentBetTypes(tournamentBetType);
         if (result)
         {
             _logger.LogInformation("Bet Type Mapping Successfully Added");
             return(StatusCode(200, StatusCodes.ReturnStatusObject("Successfully Added.")));
         }
         else
         {
             _logger.LogError("Bet Type has Failed to Add. Bet Type - {0}", tournamentBetType);
             return(StatusCode(400, StatusCodes.ReturnStatusObject("Bet Type Mapping failed to add.")));
         }
     }
     catch (Exception e)
     {
         _logger.LogError("Error Bet Type failed to add . Error - {0} , Data - {1}", e.Message, tournamentBetType);
         return(StatusCode(400, StatusCodes.ReturnStatusObject("Error Bet Type Mapping Failed to Add.")));
     }
 }
コード例 #2
0
        public bool AddTournamentBetTypes(TournamentBetType tournamentBetType)
        {
            using (var connection = DatabaseService.SqlConnection())
            {
                var parameters = new {
                    tournamentBetType.TournamentId,
                    tournamentBetType.BetTypeId
                };

                var result = connection.Execute("sp_AddTournamentBetType", parameters, commandType: CommandType.StoredProcedure);
                return(result < 0);
            }
        }
コード例 #3
0
 public IActionResult Update(int?tbTId, TournamentBetType tournamentBetType)
 {
     try
     {
         if (tbTId.HasValue && tournamentBetType.TbTid == tbTId)
         {
             _tournamentBetType.Update(tournamentBetType);
             _logger.LogInformation("Recotrd updated");
             return(Ok("Record sucessfully updated"));
         }
         else
         {
             return(BadRequest("There was an error processing your request"));
         }
     }
     catch (Exception ex)
     {
         return(BadRequest($"There was an error processing your request {ex}"));
     }
 }
コード例 #4
0
 public IActionResult Create(TournamentBetType tournamentBetType)
 {
     try
     {
         if (tournamentBetType != null)
         {
             _logger.LogInformation("Record successfully created");
             _tournamentBetType.Add(tournamentBetType);
             return(Ok("record successfully created"));
         }
         else
         {
             return(BadRequest("There was an error processing request"));
         }
     }
     catch (Exception ex)
     {
         _logger.LogError("An error occured while trying to process post request ", ex);
         return(BadRequest($"There was an error trying to process your request {ex}"));
     }
 }
コード例 #5
0
 public void Update(TournamentBetType tournamentBetType)
 {
     _tournamentBetType.Update(tournamentBetType);
 }
コード例 #6
0
 public void Add(TournamentBetType tournamentBetType)
 {
     _tournamentBetType.Add(tournamentBetType);
 }
コード例 #7
0
 public void Update(TournamentBetType tournamentBetType)
 {
     _context.Entry(tournamentBetType).State = EntityState.Modified;
     _context.SaveChanges();
 }
コード例 #8
0
 public void Add(TournamentBetType tournamentBetType)
 {
     _context.TournamentBetType.Add(tournamentBetType);
     _context.SaveChanges();
 }