コード例 #1
0
ファイル: Ad.cs プロジェクト: umayr/olx
        public bool Save()
        {
            List <SqlParameter> param = new List <SqlParameter>
            {
                new SqlParameter("@unique_id", _guid),
                new SqlParameter("@title", Title),
                new SqlParameter("@location", Location),
                new SqlParameter("@ad_id", AdId),
                new SqlParameter("@price", Price),
                new SqlParameter("@seller", Seller),
                new SqlParameter("@seller_contact", SellerContact),
                new SqlParameter("@description", Description),
                new SqlParameter("@type", Type),
                new SqlParameter("@has_picture", HasPictures),
                new SqlParameter("@raw_price", int.Parse(new string(Price.AsEnumerable().Where(char.IsDigit).ToArray())))
            };

            foreach (List <SqlParameter> _params in _pictureUrls.Select(imgUrl => new List <SqlParameter> {
                new SqlParameter("@unique_id", _guid),
                new SqlParameter("@url", imgUrl)
            }))
            {
                DB.ExecuteProcedure("usp_insertImgUrl", _params);
            }
            return(DB.ExecuteProcedure("usp_insertAd", param));
        }