Esempio n. 1
0
        public bool DeleteUserTeamChip(int userTeamid, int gamweekid, int chipid, SqlConnection db)
        {
            try
            {
                bool rowsDeleted  = false;
                var  userTeamChip = new UserTeamChip();

                userTeamChip = db.Get <UserTeamChip>(chipid);
                rowsDeleted  = db.Delete(new UserTeamChip()
                {
                    userteamid = userTeamid
                });

                if (rowsDeleted == true)
                {
                    Logger.Out("UserTeamChip: " + userTeamChip.name + " (" + Convert.ToString(chipid) + ") - deleted");
                    return(true);
                }
                return(false);
            }
            catch (Exception ex)
            {
                Logger.Error("UserTeamChip Repository (DeleteUserTeamChip) error: " + ex.Message);
                throw ex;
            }
        }
Esempio n. 2
0
        //public class UserTeamChipRepository : IUserTeamChip
        //{
        //    public bool InsertUserTeamChip(UserTeamChip userTeamChip)
        //    {
        //        try
        //        {
        //            int rowsAffected = 0;

        //            using (IDbConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings["FantasyPremierLeagueUserTeam"].ConnectionString))
        //            {
        //                rowsAffected = (int)db.Insert(userTeamChip);
        //            }

        //            if (rowsAffected > 0)
        //            {
        //                Logger.Out("UserTeamChip: " + userTeamChip.name + " - inserted");
        //                return true;
        //            }
        //            return false;
        //        }
        //        catch (Exception ex)
        //        {
        //            Logger.Error("UserTeamChip Repository (insert) error: " + ex.Message);
        //            Logger.Error("UserTeamChip Repository (insert) error: " + ex.InnerException);
        //            throw ex;
        //        }
        //    }

        public bool UpdateUserTeamChip(UserTeamChip userTeamChip, SqlConnection db)
        {
            try
            {
                bool rowsUpdated = false;

                rowsUpdated = db.Update(userTeamChip, commandTimeout: 0);

                if (rowsUpdated == true)
                {
                    Logger.Out("UserTeamChip: " + userTeamChip.name + " - updated");
                    return(true);
                }
                return(false);
            }
            catch (Exception ex)
            {
                Logger.Error("UserTeamChip Repository (update) error: " + ex.Message);
                throw ex;
            }
        }