Ejemplo n.º 1
0
        public Special Save(Special special)
        {
            using (var connection = ConnectionStrings.GetOpenConnection())
            {
                connection.Execute(
                    "SaveSpecial",
                    special,
                    commandType: CommandType.StoredProcedure
                    );
            }

            return(special);
        }
Ejemplo n.º 2
0
        public Make Save(Make make)
        {
            using (var cn = ConnectionStrings.GetOpenConnection())
            {
                cn.Execute(
                    "SaveMake",
                    make,
                    commandType: System.Data.CommandType.StoredProcedure
                    );
            }

            return(make);
        }
Ejemplo n.º 3
0
        public Purchase SavePurchase(Purchase purchase)
        {
            using (var cn = ConnectionStrings.GetOpenConnection())
            {
                cn.Execute(
                    "SavePurchase",
                    purchase,
                    commandType: System.Data.CommandType.StoredProcedure
                    );
            }

            return(purchase);
        }
Ejemplo n.º 4
0
        public ContactForm AddContactForm(ContactForm contactForm)
        {
            using (var connection = ConnectionStrings.GetOpenConnection())
            {
                connection.Execute(
                    "AddContactForm",
                    contactForm,
                    commandType: System.Data.CommandType.StoredProcedure
                    );
            }

            return(contactForm);
        }
Ejemplo n.º 5
0
        public List <Make> GetMakes()
        {
            List <Make> makes = new List <Make>();

            using (var cn = ConnectionStrings.GetOpenConnection())
            {
                makes = cn.Query <Make>(
                    "GetMakes",
                    commandType: System.Data.CommandType.StoredProcedure
                    ).ToList();
            }

            return(makes);
        }
        public List <ExteriorColor> GetAll()
        {
            List <ExteriorColor> colors = new List <ExteriorColor>();

            using (var cn = ConnectionStrings.GetOpenConnection())
            {
                colors = cn.Query <ExteriorColor>(
                    "GetAllExteriorColors",
                    commandType: CommandType.StoredProcedure
                    ).ToList();
            }

            return(colors);
        }
Ejemplo n.º 7
0
        public List <BodyStyle> GetAll()
        {
            List <BodyStyle> bodies = new List <BodyStyle>();

            using (var cn = ConnectionStrings.GetOpenConnection())
            {
                bodies = cn.Query <BodyStyle>(
                    "GetAllBodyStyles",
                    commandType: CommandType.StoredProcedure
                    ).ToList();
            }

            return(bodies);
        }
Ejemplo n.º 8
0
        public List <Listing> GetSoldListings()
        {
            List <Listing> listings;

            using (var connection = ConnectionStrings.GetOpenConnection())
            {
                listings = connection.Query <Listing>(
                    "GetSoldListings",
                    commandType: CommandType.StoredProcedure
                    ).ToList();
            }

            return(listings);
        }
Ejemplo n.º 9
0
        public List <State> GetAll()
        {
            List <State> states;

            using (var connection = ConnectionStrings.GetOpenConnection())
            {
                states = connection.Query <State>(
                    "StatesSelectAll",
                    commandType: CommandType.StoredProcedure
                    ).ToList();
            }

            return(states);
        }
Ejemplo n.º 10
0
        public bool DeleteListing(int id)
        {
            using (var cn = ConnectionStrings.GetOpenConnection())
            {
                var parameters = new DynamicParameters();
                parameters.Add("@ListingId", id);

                cn.Execute(
                    "ListingDelete",
                    parameters,
                    commandType: CommandType.StoredProcedure
                    );
            }

            return(true);
        }
Ejemplo n.º 11
0
        public bool DeleteSpecial(int id)
        {
            using (var connection = ConnectionStrings.GetOpenConnection())
            {
                var parameters = new DynamicParameters();
                parameters.Add("@SpecialId", id);

                connection.Execute(
                    "DeleteSpecial",
                    parameters,
                    commandType: CommandType.StoredProcedure
                    );
            }

            return(true);
        }
Ejemplo n.º 12
0
        public Listing GetListingById(int id)
        {
            Listing listing;

            using (var cn = ConnectionStrings.GetOpenConnection())
            {
                var parameters = new DynamicParameters();
                parameters.Add("@ListingId", id);

                listing = cn.Query <Listing>(
                    "GetListingById",
                    parameters,
                    commandType: CommandType.StoredProcedure
                    ).SingleOrDefault();
            }

            return(listing);
        }
Ejemplo n.º 13
0
        public State GetState(int stateId)
        {
            State stateToReturn;

            using (var connection = ConnectionStrings.GetOpenConnection())
            {
                var parameters = new DynamicParameters();
                parameters.Add("@StateId", stateId);

                stateToReturn = connection.Query <State>(
                    "GetState",
                    parameters,
                    commandType: CommandType.StoredProcedure
                    ).SingleOrDefault();
            }

            return(stateToReturn);
        }