コード例 #1
0
        public virtual ProductStore UpdateProductStore(ProductStore entity)
        {
            if (entity.IsTransient())
            {
                return(entity);
            }
            ProductStore other = GetProductStore(entity.ProductId);

            if (entity.Equals(other))
            {
                return(entity);
            }
            string sql = @"Update ProductStore set  [ID]=@ID
							, [StoreID]=@StoreID
							, [CreatedOn]=@CreatedOn 
							 where ProductID=@ProductID"                            ;

            SqlParameter[] parameterArray = new SqlParameter[] {
                new SqlParameter("@ProductID", entity.ProductId)
                , new SqlParameter("@ID", entity.Id)
                , new SqlParameter("@StoreID", entity.StoreId)
                , new SqlParameter("@CreatedOn", entity.CreatedOn)
            };
            SqlHelper.ExecuteNonQuery(this.ConnectionString, CommandType.Text, sql, parameterArray);
            return(GetProductStore(entity.ProductId));
        }